Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Add Edit Permission to Profile Extender Plugin
meshugy
✭✭
I'd like to only grant access to the extended profile fields for specific roles. Is there an easy way to add an "Edit" setting for the Profile Extender Plugin in the Dashboard Roles and Permissions menu?
The plugin already has an "Add" setting, but that on controls user added fields. I'd like to be able to grant permissions for the system wide fields I've created.
thanks!
0
Comments
you can register a new permission like
C("Garden.Profile.EditUsernames")
or C("Garden.Settings.Manage")
If you want to add an extra permission to be checked
if (!Gdn::Session()->CheckPermission('Garden.Users.Edit') && !C("Garden.Profile.EditUsernames")) {
you can look at the class.usermodel.php for guidance
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
V,
good advice in checking permission method,
but i think the C (Configuration) part needs to be explained, it is not role based by nature.
The C just checks if you have a configuration statement and its value. It does not check roles or permissions table.
so C("Garden.Settings.Manage") would be a red herring. unless you already had a config statement called
$Configuration['Garden']['Settings']['Manage'] = FALSE;
and it would be totally unrelated to the already existing
CheckPermission('Garden.Settings.Manage')
and doubly confusing.
Garden.Settings.Manage - refers to the permission in the permission table.
if you want to add customized role permissions to a plugin
you would add it here...
in the PluginInfo
'RegisterPermissions' => array('Plugins.ProfileExtender.Add'),
e.g. to add a new permission called Edit
'RegisterPermissions' => array('Plugins.ProfileExtender.Add',Plugins.ProfileExtender.Edit),
then you would need to go to each method or in the view in plugin. and isolate what you want.
if (CheckPermission('Plugins.ProfileExtender.Edit')) : ?>
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine Could not have said it better myself!