cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

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

jbailey
17-Peridot

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

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?

ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

8 REPLIES 8

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
17-Peridot
(To:d_graham)

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

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

jbailey
17-Peridot
(To:d_graham)

Great, thanks. I will have to look at the customization guide on this.

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.

avillanueva
22-Sapphire II
(To:d_graham)

Improved Exception message:

 

Then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out.

😂

jbailey
17-Peridot
(To:d_graham)

Awesome, any guidance on where I should start with this?

Announcements


Top Tags