Skip to main content
jbailey
18-Opal
November 13, 2024
Solved

Anyone have a way to limit the number of people in a group?

  • November 13, 2024
  • 1 reply
  • 1551 views

Version: Windchill 13.0

 

Use Case: There are probably several use cases for this, however mine is pretty specific. I would like to find out if there is an ability to limit the number of people in a group.


Description:

I work at a multi-location organization where each location has their own budget/allocation of resources. We are looking at consolidating Windchill into a single instance, however the locations need to independently manage their allocation of licenses. My thought would be to have a group assigned to each location for each license, and limit the number of people that can be added to the group based on the number of licenses allocated to that location.

 

Thoguhts?

Best answer by d_graham

James, I couldn't resist so I got this working.

In my code I've limited the number for users in the "Administrators" group to two.

 

In the screenshot below I have two users in this group.

d_graham_0-1731609421818.png

 

When I attempt to add another user....

d_graham_1-1731610163605.png

 

I'm notified that the maximum number of users for this group is 2 and I cannot add another user.

d_graham_2-1731610273164.png

 

And yes, the code takes into account users that are in sub-groups.

1 reply

18-Opal
November 13, 2024

Not a problem @jbailey 

Use a listener to detect when a user or group is added to the group in question. If this addition exceeds the allowable number throw an exception state the max number is X and that number had been exceeded by Y users.

jbailey
jbailey18-OpalAuthor
18-Opal
November 14, 2024

Since we don't do much customization here, I may ask a few "basic" questions... Could this easily be done with specific groups?

18-Opal
November 14, 2024

@jbailey , yes, this can be done to any group(s) you specify.