Yii Framework Forum: [Yii Smart Menu] Extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Yii Smart Menu] Extension Extends CMenu n' autocheck permissions to define menu visibility Rate Topic: ***-- 2 Votes

#1 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 29 December 2011 - 07:39 PM

Yii Smart Menu

Auto check permissions to define visibility of any menu item. Works out of the box with Rights Extension. Can be adapted to work in (almost) any enviroment.

YiiSmartMenu iterates through the items received to turn visibility=true|false depending on checkAccess results. The authItemName to be checked is formed by concatenating Module (whether any), Controller and Action defined in 'url' or 'submit' (inside linkOptions) options of your menu's items.

More in the Extension's Page

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 29 December 2011 - 07:40 PM

/* moved to extensions forum */
"Less noise - more signal"
0

#3 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 29 December 2011 - 07:45 PM

Sorry, and thanks for moving.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#4 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 29 December 2011 - 11:37 PM

Improved documentation.

Code examples are now available.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#5 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 30 December 2011 - 02:32 PM

  • Version 0.2.1
    • Allow to set the new option 'params'=>array(...) in a menu item to be sent to checkAccess() function instead of the default var $_GET;
    • Allow to set the new option 'authItemName'=>'CanDoX' in a menu item to be used in checkAccess() function instead of auto generate it based in 'url' or 'submit' options;


--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
1

#6 User is offline   zainiafzan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 10-April 11

Posted 31 December 2011 - 12:27 PM

Look nice..but didn't try yet..
Good work... :rolleyes:
0

#7 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 31 December 2011 - 06:48 PM

View Postzainiafzan, on 31 December 2011 - 12:27 PM, said:

Look nice..but didn't try yet..
Good work... :rolleyes:


Thank you Zainiafzan. Hope it to be useful to u.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#8 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 31 December 2011 - 06:50 PM

New GitHub repository:

https://github.com/s.../Yii-Smart-Menu

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
1

#9 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 03 January 2012 - 07:44 PM

  • Version 0.3.0
    • Looks for url/submit additional params to send to checkAccess() if 'authParams' is not setted. $_GET will only be sent if 'authParams' is not setted and url/submit has no additional params;
    • Improoved trace messages. Now they show what params are being sent to checkAccess();
    • The code has been refactored;


--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#10 User is offline   kavitama 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 20-September 11

Posted 18 January 2012 - 12:38 AM

View Postsidtj, on 03 January 2012 - 07:44 PM, said:

  • Version 0.3.0
    • Looks for url/submit additional params to send to checkAccess() if 'authParams' is not setted. $_GET will only be sent if 'authParams' is not setted and url/submit has no additional params;
    • Improoved trace messages. Now they show what params are being sent to checkAccess();
    • The code has been refactored;



Sid,

Is there a chance to use it with an installation of PHP 5.1?
Do I have to remove the ucfirst() function ?

Regards
0

#11 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 18 January 2012 - 07:49 AM

View Postkavitama, on 18 January 2012 - 12:38 AM, said:

Sid,

Is there a chance to use it with an installation of PHP 5.1?
Do I have to remove the ucfirst() function ?

Regards



Hi Kavitama,

Yes, it should work fine if you just remove/replace the function.
I dont remember any other PHP 5.3 restriction for now.

Regards.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#12 User is offline   Fábio Sales 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-January 11

Posted 24 January 2012 - 10:52 AM

Sidney,

Boa tarde,

Parabéns pela extensão. Porém, tentei utilizá-la aqui e não consegui. Já tenho o Rights funcionando perfeitamente então, teoricamente, se eu efetuar o login com o perfil de admin (super usuario), o menu deveria mostrar todos os ítens nos quais eu tenho acesso, correto? Desculpe a minha ignorância, mas tentei bastante aqui e não consegui. Quando uso a extensão, mesmo logado como admin, tambem não consigo acessar o rights diretamente pela url "index.php?r=righs".

Muito obrigado!,
0

#13 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 24 January 2012 - 05:49 PM

View PostFábio Wally, on 24 January 2012 - 10:52 AM, said:

Sidney,

Boa tarde,

Parabéns pela extensão. Porém, tentei utilizá-la aqui e não consegui. Já tenho o Rights funcionando perfeitamente então, teoricamente, se eu efetuar o login com o perfil de admin (super usuario), o menu deveria mostrar todos os ítens nos quais eu tenho acesso, correto? Desculpe a minha ignorância, mas tentei bastante aqui e não consegui. Quando uso a extensão, mesmo logado como admin, tambem não consigo acessar o rights diretamente pela url "index.php?r=righs".

Muito obrigado!,


Oi Fábio, obrigado.

Acredito que seu problema ao acessar o Rights não tenha relação com a extensão pois ela apenas afeta os menus que a utilizam. Quanto ao menu oculto, você precisa lembrar que se você definir 'url'=>'#' sem um 'submit'=>'xxxx', este menu ficará oculto (e todos os submenus) pois provavelmente não há um authItemName chamado {Controller}.# em suas permissions.

O que você pode fazer é definir você mesmo o nome do auth item usando a opção authItemName ou então definir você mesmo a visibilidade do menu com o visible=>{regra} e deixar que o YSM cuide dos submenus.

Outra coisa muito útil é ativar os trace logs do yii (mais informações) pois o YiiSmartMenu mostra mensagens que explicam porque cada item foi exibido ou ocultado.
Ver os exemplos na página da documentação talvez possa ser de ajuda também.

Obrigado.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#14 User is offline   deez 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 04-January 12

Posted 17 April 2012 - 01:52 PM

Hey guys.

I love this extension, but I have switched from using Rights to using UserGroups and I was wondering if anyone could point me in the right direction to modify this extension in order that it might be used outside of Rights?

I am still a yii noob, but I am learning fast and loving it.

Thanks
0

#15 User is offline   fpolli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 26-April 12

Posted 30 April 2012 - 08:32 PM

View Postdeez, on 17 April 2012 - 01:52 PM, said:

Hey guys.

I love this extension, but I have switched from using Rights to using UserGroups and I was wondering if anyone could point me in the right direction to modify this extension in order that it might be used outside of Rights?

I am still a yii noob, but I am learning fast and loving it.

Thanks


I just looked at UserGroups and it looks great. I am just starting an app, and I installed yii-user and rights, and I think I want to use UserGroups instead. I would love an answer to this same question: How to use this with UserGroups.
0

#16 User is offline   sidtj 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 22-October 10

Posted 01 May 2012 - 06:10 AM

View Postfpolli, on 30 April 2012 - 08:32 PM, said:

I just looked at UserGroups and it looks great. I am just starting an app, and I installed yii-user and rights, and I think I want to use UserGroups instead. I would love an answer to this same question: How to use this with UserGroups.


I am very busy these days but I will try to take that in account in the next release.
For now, I can not imagine a way to check access through accessRules (i am not familiar with filter for now) but I guess it should not be so hard to implement. As soon as I can I will try to publish at least a workaround.

Any insights about how to check permissions using filters are very welcome, anyway.

Thank you.

--

Sidney Lins
sidtj


Yii Smart Menu
Let YSM automagically hide/show your cmenu items according to result of checkAccess() function.

Yii Conditional Validator
Make validation using core validators based in conditions.


Posted ImageLista Yii Framework Brasil
A maior e mais ativa lista de discussão por e-mail em português.

Participe!
0

#17 User is offline   Pablopunch 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 13-March 14

Posted 13 March 2014 - 06:16 PM

Hi all, I implemented this extension and its working great for the most part. The only issue I am have is when I do any searches in my Admin menus I get an error. I have posted a pic to demo what issue I am having. Any help?

Thanks

Attached File(s)


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users