Is it possible to add permissions or add a different role to a user on one particular form/page and for those to be removed after the form has been submitted?

It is particularly for when one user creates a new user (using subuser module). They need "Administer Organic groups permissions: Administer all groups and permissions." permissions to set the new users organic group on creation, but they must not be allowed to edit other groups!

1 Answer 1


Adding permissions on the fly would be hard without writing your own module.

However, maybe there are round-about ways of accomplishing what you need. Two suggestions:

1) You can add a taxonomy field to your user account that can be set and then use the rules module to automatically add new users to a certain group based on the terms they were tagged with during creation...

2) If you go to: admin/config/group/permissions/node/group, you can see that you can set permissions for members, non-members and admin members of a group, and you can set the 'add user' permission depending on those user group roles. If you set those to your liking, your workflow can then be a 2-step process: 1) create user account, 2) add user to whatever groups you need. It's more cumbersome, since it's a 2-step process, but only members or managers of a group will be able to add users to that group.

Final note: creating/editing permissions on the fly like you're thinking may have unintended consequences. You're saying that users should not be allowed to edit other groups, but if you try granting and revoking permissions based on opening and then submitting a form, you'll actually be giving users the ability to administer all groups until they submit that form! If they forget and don't submit it or leave it open in their browser for a long time, they'll potentially have that admin-level permission and see all relevant links, blocks and associated admin sections for a long time. So I suggest you try an approach like the above then attempting to grant 'temporary' permissions. :-)

  • I had thought of that flaw in changing permissions, so was hoping there would be another way!
    – mingomango
    Commented Jul 19, 2012 at 12:20
  • I did have a go with rules, but couldn't quite get it to work as I wanted. I can trigger the rule on the correct EVENT and set the CONDITION. However, I couldn't work out the ACTION rule to add the created user to the same organic group as the "primary user". For whichever action I tried (Add enity to group, subscribe user to group) I couldn't seem to get the Group id to associate with the new user id. Do you know how to do this? I did manage to set a message and redirect to the groups add-user form, but being able to ad them to the group using the rules would be much better.
    – mingomango
    Commented Jul 19, 2012 at 12:21
  • I have a "Primary user" set up with group administrator permissions who has "Add user"permissions - the created user has "standard user" role.
    – mingomango
    Commented Jul 19, 2012 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.