I have found an example of setting role's permissions in the template.xml file that comes with the module:

<!-- overwirte will cause all other permissions for rid 4 
    (except those defined within this action) to be reset/disabled
-->
    <permissions rid="editor" overwrite="1">access comments, administer blocks, administer filters, post comments</permissions>

This code doesn't seem to work as expected. Values supplied in the
tag do not overwrite the existing permissions but get merged with them. i.e. overwrite="1" seems to be ignored

Comments

dan.nsk’s picture

Status: Active » Needs review
StatusFileSize
new650 bytes

Patch attached

dan.nsk’s picture

Title: Permissions not overwriting » Unable to delete or overwrite permissions
StatusFileSize
new1.08 KB

After further experiments I discovered an another similar problem with permissions modifying.

Patterns with delete attribute set to "1" do not work properly either. The following example has been taken from the template.xml supplied with the module:

    <!-- remove permissions -->
    <permissions role="editor" delete="1">
      <value>administer blocks</value>
      <value>access comments</value>
    </permissions>

After running such a pattern the role keeps all its previous permissions and is given one extra (the first item of the general permissions list).

Here is a new improved patch that fixes both of the problems - with delete and overwrite attributes

Shawn_S’s picture

I just noticed this as well so I applied your patch and it solved the problem.

1+ vote for this patch to be included.

dan.nsk’s picture

This is kind of temporary solution. After all problems with handling of checkboxes in patterns_sync_form_values() are solved (see #588040: Disabling modules fails for explanation) this patch will become redundant.

vaish’s picture

Status: Needs review » Fixed

Issue with patterns_sync_form_values() has been fixed which makes this patch unnecessary. Both "overwrite" and "delete" should work now as expected. Please let me know if you still run into any issues.

@dan.nsk - thanks for providing this patch as an interim solution.

Vaish

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.