I guess firstly I'm not entirely sure I understand what the settings are controlling. For instance, I have the following code:
function mymodule_block_permission() {
return array(
'administer mymodule header block' => array(
'title' => t('Administer mymodule Header Block Settings'),
),
);
}
function mymodule_block_variable_info($options = array()) {
$variable = array();
$variable['mymodule_block_header_contact'] = array(
'type' => 'string',
'title' => t('mymodule Header Contact Message', array(), $options),
'description' => t('The text to display in the header contact block.'),
'default' => 'call us: 555 555 5555',
'group' => 'mymodule_header_settings',
);
return $variable;
}
function mymodule_block_variable_group_info() {
$groups = array();
$groups['mymodule_header_settings'] = array(
'title' => t('mymodule Header Settings'),
'description' => t('Configure settings relating to the mymodule Header.'),
'access' => 'administer mymodule header block',
'admin' => array('admin/mymodule/header'),
);
return $groups;
}
My confusion is that users given the permission 'administer mymodule header block' are still unable to view the variable settings page, either on:
- http://localhost/admin/config/system/variable/group/mymodule_header_sett...
... which would be default, or:
- http://localhost/admin/mymodule/header
... as defined in the hook_variable_group_info.
1) FIrstly, I don't understand why the 'access' setting set in hook_variable_group_info is being ignored, or denied by another permission.
2) Nor do I understand the purpose of the 'admin' setting, I'm not defining the page anywhere else such as via hook_menu.
Thanks for any clarification!
Comments
Comment #1
jose reyero commentedPages generated by variable admin need the 'administer site configuration' permission. About the module page, it will have its own permission too to acess the page, then will check for permissions for each of the variables in the page.
The admin setting is not used anywhere yet but the idea is to provide information about where each variable / group can be edited.
Comment #3
jeni_dc commentedSorry to reopen and if there's overlap with i18n_variable module, but I don't fully understand what you're saying regarding the permissions.
I'm using a custom form in my module with system_settings_form() to set multilingual variables. I've created a group for the variables like so:
Access to "/admin/my-module" is controlled from the same "my module custom permission" permission in a hook_menu(). When on that page, users with a role that have the assigned "my module custom permission" cannot see any of the translations. But if I grant them the "administer site configuration" they can.
1) Is this an issue with access from Variable module, or is i18n_variable responsible for this? (I can't see where it would be i18n_variable).
2) How do I allow my users to edit these multilingual variables without granting them the "administer site configuration" permission?
You mentioned:
My module page does have it's own permission. And if I explicitly set access on each of the variables to "my module custom permission" they still can only edit the English vars.
Comment #4
jeni_dc commentedIn doing a bit more research I saw where the variables are being switched per realm in variable_realm_init().
It's that
user_access('administer site configuration')which is causing my problems since I don't want to give that out to this specific user role. My solution is to add my own hook init and check for my custom admin path and permission: