|
Allow users to edit only their own contents
|
|
10-Aug-2012, 07:03 AM
Post: #1
|
|||
|
|||
|
Allow users to edit only their own contents
Hello:
I have extended the cms module to allow personal messages and show groups and categories at the same time. So now I have a new module, myfirm-cms, with pretty much the same functionality as the original one. What I want to do now is to allow the users to edit and delete their own contents despite they may be forbidden to do so at the roles admin section. That is, only admins can edit/delete any content, but each user can do so with their own content. I don't know where to override the default behaviour (I think the method is isAllowed) only for this module so that the user doesn't get a "YOU DONT HAVE PERMISSIONS" message when they go to myfirm-cms/edit/edit on one of their contents even if they don't have such permissions. Thank you, |
|||
|
10-Aug-2012, 12:39 PM
(This post was last modified: 10-Aug-2012 12:40 PM by mayorbrain.)
Post: #2
|
|||
|
|||
|
RE: Allow users to edit only their own contents
Yea, you could work on isAllowed(), but I think it will be easier to move higher in the execution heirarchy. Go to Initializer::performAcl().
In the performAcl() function, you will come across this PHP Code: if($request->getModuleName() == 'cms')//the cms module has its controller has the privilege and not its actionJust before that snippet, add this line PHP Code: if($request->getModuleName() == 'myfirm-cms')This will ignore access control for the 'myfirm-cms' module. |
|||
|
13-Aug-2012, 12:56 AM
Post: #3
|
|||
|
|||
|
RE: Allow users to edit only their own contents
Thank you for pointing out where to find the code for the permissions logic.
Based on the code you provided, I finally took a slightly different approach. In case somebody is interested: PHP Code: if($request->getModuleName() == 'cms')//the cms module has its controller has the privilege and not its action |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)

Search
Member List
Calendar
Help



