Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. role FREEUSER{
  2. Person{
  3. read(name), read(surname), read(role), read(username), read(livesAt)//1
  4. read(subscriptions)//2
  5. update(name), update(surname), update(livesAt), update(password) constrainedBy [caller=self]//3
  6. add(subscriptions) constrainedBy [self.subscriptions->size()<2 and caller=self] //4
  7. remove(subscriptions) constrainedBy [caller=self]//5
  8. read(attends) constrainedBy [caller=self]//6
  9. remove(attends) constrainedBy [self.events->excludes(target) and self.manages->excludes(target) and caller=self]//7
  10. read(invitations) constrainedBy [caller=self]//8
  11. add(attends) constrainedBy [(caller=self) or (target.requesters->includes(self) and caller.manages->includes(target) and (target.attendants->size()+target.invitations->size())<4 )] //9 16E 24
  12. read(events) constrainedBy [caller=self]//10
  13. read(manages) constrainedBy [caller=self]//11
  14. add(invites) constrainedBy [self.manages->includes(target.event) and (target.event.attendants->size()+target.event.invitations->size())<4] //16B order matters
  15. add(invitations) constrainedBy [caller.manages->includes(target.event) and (target.event.attendants->size()+target.event.invitations->size())<4]//16B and 24
  16. remove(requests) constrainedBy [self.manages->includes(target)] //16E
  17. add(requests) constrainedBy [caller=self]//17
  18. read(requests) constrainedBy [caller=self]//18
  19. add(events),add(manages) constrainedBy [self.events->size()<4 and caller=self]//23
  20. }
  21.  
  22. Event{
  23. remove(attendants) constrainedBy [self.owner<>target and self.managedBy->excludes(target) and caller=target]//7
  24. add(attendants) constrainedBy [(caller=target) or ( target.requests->includes(self) and self.managedBy->includes(caller) and (self.attendants->size()+self.invitations->size())<4)] //9 16E:first add as attendant then remove as requestor; 24 (16e and 24)
  25. read(title), read(description), read(location), read(hour), read(min), read(date)//12
  26. read(owner), read(categories)//13
  27. read(managedBy)//14
  28. read(attendants) constrainedBy [self.attendants->includes(caller)]//15
  29. read(invitations) constrainedBy [self.managedBy->includes(caller)]//16A
  30. add(invitations) constrainedBy [caller.manages->includes(self) and target.event=self and (self.attendants->size()+self.invitations->size())<4 ]//16B or 24
  31. add(categories) constrainedBy [self.managedBy->includes(caller)]//16C
  32. remove(categories) constrainedBy [self.managedBy->includes(caller)]//16C
  33. update(title), update(description), update(location),update(hour), update(min), update(date) constrainedBy [self.managedBy->includes(caller)]//16D
  34. read(requesters) constrainedBy [self.managedBy->includes(caller)] //16E
  35. remove(requesters) constrainedBy [self.managedBy->includes(caller)] //16E
  36. add(requesters) constrainedBy [target=caller]//17
  37. create constrainedBy [caller.events->size()<3]//23
  38. update(owner) constrainedBy [caller.events->size()<3 and value=caller]//23
  39. }
  40.  
  41. Category{
  42. add(subscribers) constrainedBy [target.subscriptions->size()<2 and caller=target] //4
  43. remove(subscribers) constrainedBy [caller=target]//5
  44. add(events) constrainedBy [target.managedBy->includes(caller)]//16C
  45. remove(events) constrainedBy [target.managedBy->includes(caller)]//16C
  46. read(name)//20
  47. read(events)//21
  48. read(subscribers), read(moderators) constrainedBy [self.subscribers->includes(caller)]//22
  49. }
  50.  
  51. Invite{
  52. read(invitedBy), read(event), read(invitee) constrainedBy [caller=self.invitee or self.event.managedBy->includes(caller)]//8
  53. create //16B
  54. update(invitedBy) constrainedBy [(value=caller) and (self.event.attendants->size()+self.event.invitations->size())<5] //16B caller.manages->includes(self.event) but the order matters and 24
  55. update(event) constrainedBy [caller.manages->includes(value) and (value.attendants->size() + value.invitations->size())<4]//16B and 24
  56. update(invitee) constrainedBy [(caller.manages->includes(self.event)) and ((self.event.attendants->size()+self.event.invitations->size())<5)]//16B and 24
  57. delete constrainedBy [caller=self.invitee]
  58. }
  59.  
  60. Location{
  61. read(name), read(country)//19
  62. add(events) constrainedBy [caller.events->size()<4 and target.owner=caller]//23
  63. }
  64. }
  65.  
  66. role PREMIUMUSER extends FREEUSER{
  67. Person{
  68. add(subscriptions) constrainedBy [caller=self] //25
  69. add(events) //26
  70. add(manages) constrainedBy [self = target.owner ]
  71. remove(manages) constrainedBy [self = target.owner and target.attendants->includes(self)] // 27
  72. add(invites) constrainedBy [self.manages->includes(target.event)] // 29
  73. add(invitations) constrainedBy [caller.manages->includes(target.event)]// 29
  74. add(attends) constrainedBy [(caller=self) or target.requesters->includes(self)] //29
  75. }
  76.  
  77. Event{
  78. create // 26
  79. update(owner) constrainedBy [value=caller] // 26
  80. add(managedBy), remove(managedBy) constrainedBy [self.owner = caller and self.attendants->includes(target)] //27A e B
  81. read(attendants)
  82. add(invitations) constrainedBy [caller.manages->includes(self) and target.event=self] // 29
  83. add(attendants) constrainedBy [(caller=target) or target.requests->includes(self)] // 29
  84. }
  85.  
  86. Category{
  87. add(subscribers) constrainedBy [target=caller] //25
  88. }
  89.  
  90. Invite{
  91. update(invitedBy) constrainedBy [(value=caller)] // 29
  92. update(event) constrainedBy [caller.manages->includes(value) ]//29
  93. update(invitee) constrainedBy [(caller.manages->includes(self.event))]//29
  94. }
  95.  
  96. Location{
  97. add(events) constrainedBy [ target.owner=caller] //26
  98. }
  99.  
  100. }
  101. role MODERATOR extends PREMIUMUSER{
  102. Person{
  103.  
  104. }
  105.  
  106. Event{
  107. update(title), update(description) constrainedBy [caller.moderates.events->includes(self)] //31
  108. }
  109.  
  110. Category{
  111. read(name) constrainedBy [self.moderators->includes(caller)] //30
  112. }
  113.  
  114. Invite{
  115.  
  116. }
  117.  
  118. Location{
  119.  
  120. }
  121.  
  122. }
  123. role ADMIN extends MODERATOR{
  124. Person{
  125. create // 32
  126. update(name), update(surname), update(username), update(password), update(livesAt), update(role) //33
  127. add(moderates) // 39
  128. }
  129.  
  130. Event{
  131. fullAccess
  132. }
  133.  
  134. Category{
  135. create // 36
  136. update(name) // 37
  137. read(moderators) // 38
  138. add(moderators), remove(moderators) // 39
  139. }
  140.  
  141. Invite{
  142.  
  143. }
  144.  
  145. Location{
  146. create //34
  147. update(name), update(country) //35
  148. }
  149. }
  150.  
  151.  
  152. role SYSTEM{
  153. // Do NOT change SYSTEM role's permissions
  154. Person{
  155. fullAccess
  156. }
  157.  
  158. Event{
  159. fullAccess
  160. }
  161.  
  162. Category{
  163. fullAccess
  164. }
  165.  
  166. Invite{
  167. fullAccess
  168. }
  169.  
  170. Location{
  171. fullAccess
  172. }
  173. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement