Is there a way to limit the number of subusers a particular user can create?

Comments

boombatower’s picture

Category: support » feature
Status: Active » Postponed (maintainer needs more info)

Been on vacation.

Not currently, but that shouldn't be too difficult. Are you looking for a static number or something that can be dynamically defined per user even? (possibly controlled by other modules)

jdblank’s picture

I was looking for a dynamically defined number per user.

It turns out we had to do something from scratch as we need the sub users attached to a node rather than a user as more than one user would need to add or edit subusers.

boombatower’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Sounds like you don't need this anymore and not something I have time to work on. So if you are alright with it I am going to mark this as won't fix for now.

Rosamunda’s picture

I´m sorry I would like to add a +1 to this... would I need to fill in another issue or I could just activate this one?
Thanks! This module rocks!

Rosamunda

boombatower’s picture

Status: Closed (won't fix) » Active

Not sure I'll have time to write this during my free time soon. If anyone wants to provide a patch or sponsor that would be great.

density’s picture

could really do with this:

role 1 - can add 1 subuser
role 2 - can add 2 subusers
role 3 - can add 3 subusers

any help on the best way to go about this would be great

Juan C’s picture

+1

Liembo-1’s picture

+1

hello@melmcdougall.com’s picture

+1

franzkewd’s picture

mee too +1

Grayside’s picture

Assigned: Unassigned » Grayside

I am working on a configurable limit. Not going to tackle variation by roles or permission to override right now.

Grayside’s picture

Status: Active » Needs review

Adds a configurable field to the settings page to specify a maximum number of subusers per user. Leave as "0" for no limit.

The patch is not configurable by role, nor is there a bypass permission to allow some roles to ignore the limit. Both of these seem like good ideas for followup issues.

This patch also adds two API functions to subuser.module. subuser_get_subusers() and subuser_get_parent(). The first one I used in this patch. The second seemed obvious to complete a matched set.

Grayside’s picture

StatusFileSize
new3.64 KB

Upload fail.

Grayside’s picture

StatusFileSize
new3.63 KB

Fixed the weirdness in subuser_get_subusers() where subusers were stored as keys pointing at the parent... when we already know who the parent is.

vkareh’s picture

StatusFileSize
new3.42 KB

This is an awesome addition to the module. Thanks for your work!

I added an extra permission: bypass subuser limit. It's a very simple permission check at the moment of subuser creation, so it should work for most cases.

Please test and let me know if it needs anything else.

fusedpro’s picture

Status: Needs review » Reviewed & tested by the community

Everything looks good.

blakehall’s picture

Reviewed and tested. The patch in #15 gets a +1 from me too.

blakehall’s picture

StatusFileSize
new3.96 KB

Just a small tweak to subuser_get_subusers so that the returned array of users has the uid as the key as well as the value. This small tweak will allow us to play nicely with the user modules callbacks for blocking & unblocking when needed.

Grayside’s picture

On visual inspection it still looks good.

blakehall’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed to the 6.x-1.x branch and will be part of the next release: http://drupal.org/commitlog/commit/7940/1882e3f4e2931afea666df5fbee6c883...

Thanks vkareh and Grayside!

Status: Fixed » Closed (fixed)

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