How to check for write access?
-
I have got the UAM to work as I want for editing pages, but I also want to check the write access from PHP, and that I need help for.
I have created two pages that are access controlled by two different UAM groups. Read access is set to all, write access to only group members. One user has edit capabilities and is member of one group but not the other, so the user can edit one page, but not the other. This works perfectly!
However, I also want to check the access from PHP code, because I have some text I want to be displayed only for users with write access.
I have tried code like this:
global $oUserAccessManager; if (isset($oUserAccessManager)) : $uamAccessHandler = $oUserAccessManager->getAccessHandler(); if ($uamAccessHandler->checkObjectAccess('page', get_the_ID())) : echo "Access ok"; else : echo "No access"; endif; endif;
I have tried both
checkObjectAccess
andcheckUserAccess
. Both return true on both pages, also the page where the user cannot edit.What am I missing?
- The topic ‘How to check for write access?’ is closed to new replies.