import of rt 3.0.4
[freeside.git] / rt / docs / design_docs / delegation
1 Group ACLs
2         
3         the rights:
4
5
6         CreatePersonalGroup
7         CreateGroup
8
9         AdminGroup
10                 * Update group metadata and access control list
11         AdminGroupMembers
12                 * Add ad delete members of this group
13         ModifyOwnMembership
14                 * Join and quit this group
15
16
17         the primitives:
18        
19 In user.pm
20
21 =item HasRight  { Right => 'somerightname', ObjectType => 'Group', ObjectId => 'GroupId'
22
23         Returns true if this user has the right 'somerightname' for
24 the group with id 'Id'
25
26 =cut
27
28
29 =item RightsForObject { ObjectType => 'Group', ObjectId =>'GroupId' }
30
31 in users.pm
32
33 =item WhoHaveRight { Right =>'somerightname', ObjectType => 'Group', ObjectId => 'GroupId' }
34
35
36         Finds all users who have the right 'somerightname' for the group
37 in question.
38
39         If a user has "AdminGroupMembers" globally and we ask about 
40         group 23, that user should be found.
41
42 =cut
43
44 Users must be able to delegate individual rights 
45
46         * Is it that users can delegate any and all rights but it's
47         only rights they _have_ which actually grant rights.
48
49 rights must not be redelegated
50
51 users must be able to create groups to which rights can be delegated.
52
53 Only users who have the "delegate rights" right can delegate rights.
54
55
56 When a user's right to do something is revoked, the delegation must 
57 be revoked
58
59         * For any delegated ACL check, the delegator's right must be 
60           checked immediately after the delegatee's right.
61           If a user has had a right delegated by multiple parties, 
62           this may mean that we need to actually loop through and check
63           a bunch of possible delegations. Or can we craft a "has delegated 
64           right" ACL check.
65           
66
67
68
69
70
71
72 ACL 1 Group Q has the right to Frob ObjectI.
73 ACL 2 User A has the right "DelegateRights"
74
75 Group Q has the member Group S
76 Group S has the member Group R
77 Group S has the member Group T
78 Group R has the member user A
79 Group T has the member user A
80
81 User A delegates to  Group P the right to Frob  ObjectI
82
83         New ACL rule:
84
85         ACL 3: Group P has the right to Frob ObjectI 
86                      as delegated from ACL1 by User A
87
88
89 In the case where ACL1 is revoked:
90
91         find all acls which are delegated from ACL1.
92                 Delete them
93
94 In the case where User A is removed from group R
95
96         Get the list of all groups that A was in by way of group R before the removal
97         Get the list of all groups that A is in _after_ the removal.
98
99         Find all the ACEs granted to each group that A is no longer in.
100         For each ACE in that list, find all the rights that A has delegated.
101                 Whack them.        
102
103 In the case where Group S is removed from group Q
104
105
106         Get a list of all groups that S was in by way of Q before the removal
107         Call this list O.
108
109         For each user X who's a member of S (directly or indirectly):
110         Get a list of  all groups that X is in after removal.
111         For each group in O that X is no longer a member of:
112                 Find all ACEs granted to O
113                 For each ACE, look up all the delegations that X has made.
114                         For each delegation 
115                                 WHACK IT