Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there an option to set a permission for each registration path?
Ex. Role Admin can register new users with roles Teacher and Student, role Teacher can only register a user with role Student.
Student can't register a user.
Comments
Comment #1
grasmash CreditAttribution: grasmash commentedProfile2 Registration path creates 2 basic types of forms:
1) An extension of the basic user_registration_form, which is accessible only to anonymous users.
2) An extension of the administration 'add user' form located at admin/people/create.
I could create a set of permissions for accessing the later form type. Is that what you're after?
Comment #2
alesr CreditAttribution: alesr commentedI have point 2 in mind.
Yes,, that's it. Setting a permission for each registration URL, so one role can create one type of user and the other role can create a different type of user with different fields set in Profile types.
Comment #3
grasmash CreditAttribution: grasmash commentedAlright, I'll try to add this feature in the near future.
Comment #4
j4 CreditAttribution: j4 commentedI am also interested in this feature. Thank you for your module!
Jaya
Comment #5
grasmash CreditAttribution: grasmash commentedHm, the more I think about this, the more that it seems outside the scope of this module. You're not really asking for profile related permissions, you're asking for role related permissions. A user of role A needs to be able to create a user of role B.
For D6, a module like administer users by role would have done the trick. I'd be happy to integrate with something like that.
So, I don't think this is appropriate for a P2RP release. However, accomplishing this would take a fairly simple modification.
Just define new permissions per profile type:
Then you'd need to make a custom access callback for the administrative 'add user' paths. E.g.,
The CUSTOM_CALLBACK would just have to look to see if either user_access('add user: ' . $profile_types[0]->type . ' profile') or user_access('administer users') were true.
I'm postponing for now, but leaving the issue open for discussion.
Comment #6
j4 CreditAttribution: j4 commentedHi,
For anybody arriving here, the module at this node works, http://drupal.org/node/908424, waiting for a proper D7 release though. Thanks madmatter!
Jaya
Comment #7
grasmash CreditAttribution: grasmash commentedClosing issue given j4's alternative.
Comment #8
Ilikejava CreditAttribution: Ilikejava commentedOn your comment #1: If only anonymous users can register as a P2 profile user, that means that an Authenticated user can't register without logging out? A new user that registers with a P2 profile registration form becomes Authenticated, right? So why not be able to do it both ways? I would like to be able for that to work.
Great module. Thanks.
Comment #9
shortspoken CreditAttribution: shortspoken commentedHey @Ilikejava,
did you ever find a solution for your suggestion? I am also interested in that functionality so that a authenticated user can get to the registration form and register another account. Would be nice if you shared it here.
Thanks and cheers,
Moritz