a-ok Posted December 4, 2018 Share Posted December 4, 2018 If I set the admin user in the backend to not have rights to create pages for a certain parent/child tree... can the API still publish/create? Is the API void of permissions/roles? Link to comment Share on other sites More sharing options...
louisstephens Posted December 4, 2018 Share Posted December 4, 2018 From what I understand, you could create/publish pages regardless of roles/permissions. However, if you were to wrap the page creation in an if statement like : if($user->hasPermission('permission-name', $page)) { // user has this permission, for this $page } then that person with the permission could perform whatever action you created. 2 Link to comment Share on other sites More sharing options...
kixe Posted December 4, 2018 Share Posted December 4, 2018 4 hours ago, a-ok said: Is the API void of permissions/roles? it depends! // ADD PAGE // adding a page via API can be triggered by the guest user even if he has not the permission to add children under a specific parent (12464) if ($user->isGuest()) $pages->add('contribution', 12464); // works // VIEW PAGE or FIELD VALUE // if guest user has not the view permission it depends on outputformatting if ($user->isGuest()) var_dump($pages->get(12985)->title); // "I am the Page Title" if ($user->isGuest()) var_dump($pages->get(12985)->of(true)->title); // NULL // MODULES // Call of a Module via API. User has not the permission to use the module if ($user->isGuest()) $modules->get('MyModule')->execute(); // Fatal error: Exception: You do not have permission to execute this module (if debug mode is on/ 500 otherwise) if ($user->isGuest()) $modules->getModule('MyModule', array('noPermissionCheck' => true))->execute(); // works! 2 Link to comment Share on other sites More sharing options...
a-ok Posted December 5, 2018 Author Share Posted December 5, 2018 Thanks all. So if I don't set a check then it'll void of any permissions? Great. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now