Editor User / API
Permalink 1 user found helpful
I want to customize the installer, so that after an Installation an Editor User next to the Administrator exists.
So far I managed to create an user "Editor", create a group "Editors" and place the user into this group.
But I got stuck by trying to give the "Editors" group certain rights.
I managed to give this group the rights in the task permissions (dashboard/settings/access_task_permissions/)
But how do I give the group the permission for the "Access" like in dashboard/settings/set_permissions/ ?
I also noticed, that my created User somehow does not get the Password I created:
I tried even once to give the same Password to the Admin User and the Editor User and in the Database they end up having completely different values.....??? That's weird.
And the last thing somebody may just have an answer at hand ist how I prevent this group from view & edit this tab: /dashboard/settings/set_permissions/
Do I need to use an access.xml for this?
So far I managed to create an user "Editor", create a group "Editors" and place the user into this group.
But I got stuck by trying to give the "Editors" group certain rights.
I managed to give this group the rights in the task permissions (dashboard/settings/access_task_permissions/)
But how do I give the group the permission for the "Access" like in dashboard/settings/set_permissions/ ?
I also noticed, that my created User somehow does not get the Password I created:
$data = array(); $data['uName'] = 'editor'; $data['uEmail'] = 'my@email.com'; $data['uPassword'] = 'myPassword'; $data['uIsValidated'] = -1; $data['uIsFullRecord'] = 1; //add the user UserInfo::add($data);
I tried even once to give the same Password to the Admin User and the Editor User and in the Database they end up having completely different values.....??? That's weird.
And the last thing somebody may just have an answer at hand ist how I prevent this group from view & edit this tab: /dashboard/settings/set_permissions/
Do I need to use an access.xml for this?
Thanks to Ryan I got the answer:
That does the trick!
$page = Page::getByPath('/dashboard/settings'); $g = Group::getByName('group name'); if(!$g) throw new Exception('Unable to find the group'); $permissionsConfig = new stdClass; $permissionsConfig->group[0]['gID'] = $g->getGroupID(); $permissionsConfig->group[0]['canRead'] = 1; $permissionsConfig->group[0]['canWrite'] = false; $permissionsConfig->group[0]['canApproveVersions'] = false; $permissionsConfig->group[0]['canDelete'] = false; $permissionsConfig->group[0]['canAdmin'] = false; $page->assignPermissionSet($permissionsConfig);
That does the trick!
Thanks to this post I was able to figure out my similar issue. Thanks!
> The Password was not a match cause the "salt" for the password got changed later on in the installer, thus making my created pw unusable.
> I also managed to give the Editors group more rights trough using $home->updatePermissions($args);
But I'm still stuck at how I can give certain pages read/write permissions for a group.