CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Allow creation of users within specific group
Pages: [1]

Author Topic: Allow creation of users within specific group  (Read 773 times)

joshuapurcell

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.0.4
  • CMS version: Drupal 7.4
  • MySQL version: 5.5.8
  • PHP version: 5.3.5
Allow creation of users within specific group
July 22, 2011, 08:31:12 pm
I'm trying to understand what I need to do in order allow certain users the ability to create users that will always be in a specific group (let's call this group localregion), and also to only create certain types of users. I have one group (let's call this committee) made up of a few people, and these people will only need to create, read and update users who are in a group called localregion. Right now my site allows users of the committee group to read and update users of the localregion group properly, but allowing these committee members to create a new user is not working as expected.

If I try to create a new ACL (where type = group, group = localregion, operation = create, and role = committee), I get the following error:
Code: [Select]
Only 'View' and 'Edit' operations are valid for this type of data
If I instead add the drupal permission 'CiviCRM: add contacts' to the associated Drupal role 'committee' then the proper users can create a contact and put that contact into the appropriate group. The problem with this option is that the step of adding the new contact into the needed group is still an option for these users: I would like to limit both the amount of information and options these users see when creating a new contact, where they can only create specific types of contacts (either built-in or custom) and then have all these contacts always be within the localregion group.

While looking for a way to do this, I came across the following thread:
http://forum.civicrm.org/index.php/topic,7068.0.html

This thread shows a way to automatically add new users into a specific group using the CiviCRM API. It looks as though I could limit the types of contacts people see and also automatically add the newly created users to whatever group I wanted using a similar method, but I'm new to this project and will need to look into exactly how to do this using the API (and possibly a new Drupal module). If there is some other way to do what I need other than through the API, or if I'm using the ACL function incorrectly, please let me know!
Joshua Purcell
http://identi.ca/joshuapurcell

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Allow creation of users within specific group
July 22, 2011, 11:22:38 pm

Seems like you are using the ACLs in the right manner :)

You will need to add the contacts via a hook and use the API. Another alternative might be to set the default values of the groups via a GET parameter. Check this:

http://drupal.demo.civicrm.org/civicrm/contact/add?ct=Individual&reset=1&gid=1

and then expand the Tags and Groups tab, u'll see the group with id 1 has been enabled. This is not documented but has been in the code for some time

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

joshuapurcell

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.0.4
  • CMS version: Drupal 7.4
  • MySQL version: 5.5.8
  • PHP version: 5.3.5
Re: Allow creation of users within specific group
July 25, 2011, 01:02:03 am
Thanks Lobo the link you gave will work well for the purpose of ensuring new contacts created by certain users are in the correct group (for the most part). In fact, I believe I'll be able to use a link similar to what you gave to lead them towards only creating certain types of contacts as well (although I need to verify that this will work with custom contact types). I will have these links available from a drupal block that is only visible to their drupal role.
Joshua Purcell
http://identi.ca/joshuapurcell

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Allow creation of users within specific group

This forum was archived on 2017-11-26.