We had a need to limit access to specific roles for the 'XML sitemap' fieldset on the node_form. I am submitting a patch that contains an additional perm in xmlsitemap.module and in xmlsitemap_node.module I changed the generic Drupal perm to this new, xmlsitemap specific perm. Please review.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | xmlsitemap-DRUPAL-6--2.patch | 1.56 KB | jwhat |
| #3 | xmlsitemap-DRUPAL-6--2.patch | 1.53 KB | jwhat |
| xmlsitemap.patch | 1.1 KB | jwhat |
Comments
Comment #1
dave reidWhy removing the 'administer nodes' permission check? People with that permission should see all possible options on the node.
Comment #3
jwhat commentedBecause 'administer nodes' is too generic for our needs. We have many different node types and not all roles have access to every node type. We need this more granular permission to control access for editing the xmlsitemap settings on the node form.
I recreated the patch via CVS on the proper dev branch and modified the Version tag on this issue accordingly.
Comment #4
Anonymous (not verified) commentedSo add to the permissions, not remove the 'administer nodes'.
Comment #5
Anonymous (not verified) commentedComment #6
jwhat commentedIt's actually not an access arguments array, it's a Form API #access property. How about a compromise where both permissions are required like such:
$form['xmlsitemap']['#access'] = user_access('administer nodes') && user_access('edit xmlsitemap node');
I've attached a patch reflecting this change, however I still believe the 'administer nodes' perm is too generic for this purpose.
Comment #7
Anonymous (not verified) commentedOh, yea, I was confusing hook_menu with FAPI. The orignal used |= so as to not destroy a positive value already set.
So instead of
You'll want
Comment #8
jwhat commentedI don't believe that'll work for this case because that implies an OR relationship, and we don't want 'administer nodes' alone to provide access to these settings. That's why we want to introduce this new 'edit xmlsitemap node' permission.
Comment #9
jwhat commentedI just realized why the 'administer nodes' permission cannot be used to limit the access to the xmlsitemap settings on the node_form. If we apply the 'administer nodes' permission, then we will no longer be able to limit users to specific content types, since 'administer nodes' is a global perm for all content types. I would like to suggest again that my patch in comment #3 solves this issue and enhances the flexibility of this module.
Comment #10
dave reidI looked through core to see what it does when adding things to node add/edit forms.
Comment module does '#access' => user_access('administer comments')
Menu module does '#acccess' => user_access('administer menu')
Path module does '#access' => user_access('create url aliases')
Upload module does '#access' => user_access('upload files')
Translation module does '#access' => user_access('translate content')
So I would be ok with changing that fieldset to just controlled by 'administer xmlsitemap' and removing the check on 'administer nodes'. How does that sound?
Comment #11
jwhat commentedThat's not 100% what we were going for, but it'll definitely work. Thanks!
Comment #12
dave reidFixed in CVS.
http://drupal.org/cvs?commit=372654
http://drupal.org/cvs?commit=372656