Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- role FREEUSER{
- Person{
- read(name), read(surname), read(role), read(username), read(livesAt)//1
- read(subscriptions)//2
- update(name), update(surname), update(livesAt), update(password) constrainedBy [caller=self]//3
- add(subscriptions) constrainedBy [self.subscriptions->size()<2 and caller=self] //4
- remove(subscriptions) constrainedBy [caller=self]//5
- read(attends) constrainedBy [caller=self]//6
- remove(attends) constrainedBy [self.events->excludes(target) and self.manages->excludes(target) and caller=self]//7
- read(invitations) constrainedBy [caller=self]//8
- 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
- read(events) constrainedBy [caller=self]//10
- read(manages) constrainedBy [caller=self]//11
- add(invites) constrainedBy [self.manages->includes(target.event) and (target.event.attendants->size()+target.event.invitations->size())<4] //16B order matters
- add(invitations) constrainedBy [caller.manages->includes(target.event) and (target.event.attendants->size()+target.event.invitations->size())<4]//16B and 24
- remove(requests) constrainedBy [self.manages->includes(target)] //16E
- add(requests) constrainedBy [caller=self]//17
- read(requests) constrainedBy [caller=self]//18
- add(events),add(manages) constrainedBy [self.events->size()<4 and caller=self]//23
- }
- Event{
- remove(attendants) constrainedBy [self.owner<>target and self.managedBy->excludes(target) and caller=target]//7
- 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)
- read(title), read(description), read(location), read(hour), read(min), read(date)//12
- read(owner), read(categories)//13
- read(managedBy)//14
- read(attendants) constrainedBy [self.attendants->includes(caller)]//15
- read(invitations) constrainedBy [self.managedBy->includes(caller)]//16A
- add(invitations) constrainedBy [caller.manages->includes(self) and target.event=self and (self.attendants->size()+self.invitations->size())<4 ]//16B or 24
- add(categories) constrainedBy [self.managedBy->includes(caller)]//16C
- remove(categories) constrainedBy [self.managedBy->includes(caller)]//16C
- update(title), update(description), update(location),update(hour), update(min), update(date) constrainedBy [self.managedBy->includes(caller)]//16D
- read(requesters) constrainedBy [self.managedBy->includes(caller)] //16E
- remove(requesters) constrainedBy [self.managedBy->includes(caller)] //16E
- add(requesters) constrainedBy [target=caller]//17
- create constrainedBy [caller.events->size()<3]//23
- update(owner) constrainedBy [caller.events->size()<3 and value=caller]//23
- }
- Category{
- add(subscribers) constrainedBy [target.subscriptions->size()<2 and caller=target] //4
- remove(subscribers) constrainedBy [caller=target]//5
- add(events) constrainedBy [target.managedBy->includes(caller)]//16C
- remove(events) constrainedBy [target.managedBy->includes(caller)]//16C
- read(name)//20
- read(events)//21
- read(subscribers), read(moderators) constrainedBy [self.subscribers->includes(caller)]//22
- }
- Invite{
- read(invitedBy), read(event), read(invitee) constrainedBy [caller=self.invitee or self.event.managedBy->includes(caller)]//8
- create //16B
- 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
- update(event) constrainedBy [caller.manages->includes(value) and (value.attendants->size() + value.invitations->size())<4]//16B and 24
- update(invitee) constrainedBy [(caller.manages->includes(self.event)) and ((self.event.attendants->size()+self.event.invitations->size())<5)]//16B and 24
- delete constrainedBy [caller=self.invitee]
- }
- Location{
- read(name), read(country)//19
- add(events) constrainedBy [caller.events->size()<4 and target.owner=caller]//23
- }
- }
- role PREMIUMUSER extends FREEUSER{
- Person{
- add(subscriptions) constrainedBy [caller=self] //25
- add(events) //26
- add(manages) constrainedBy [self = target.owner ]
- remove(manages) constrainedBy [self = target.owner and target.attendants->includes(self)] // 27
- add(invites) constrainedBy [self.manages->includes(target.event)] // 29
- add(invitations) constrainedBy [caller.manages->includes(target.event)]// 29
- add(attends) constrainedBy [(caller=self) or target.requesters->includes(self)] //29
- }
- Event{
- create // 26
- update(owner) constrainedBy [value=caller] // 26
- add(managedBy), remove(managedBy) constrainedBy [self.owner = caller and self.attendants->includes(target)] //27A e B
- read(attendants)
- add(invitations) constrainedBy [caller.manages->includes(self) and target.event=self] // 29
- add(attendants) constrainedBy [(caller=target) or target.requests->includes(self)] // 29
- }
- Category{
- add(subscribers) constrainedBy [target=caller] //25
- }
- Invite{
- update(invitedBy) constrainedBy [(value=caller)] // 29
- update(event) constrainedBy [caller.manages->includes(value) ]//29
- update(invitee) constrainedBy [(caller.manages->includes(self.event))]//29
- }
- Location{
- add(events) constrainedBy [ target.owner=caller] //26
- }
- }
- role MODERATOR extends PREMIUMUSER{
- Person{
- }
- Event{
- update(title), update(description) constrainedBy [caller.moderates.events->includes(self)] //31
- }
- Category{
- read(name) constrainedBy [self.moderators->includes(caller)] //30
- }
- Invite{
- }
- Location{
- }
- }
- role ADMIN extends MODERATOR{
- Person{
- create // 32
- update(name), update(surname), update(username), update(password), update(livesAt), update(role) //33
- add(moderates) // 39
- }
- Event{
- fullAccess
- }
- Category{
- create // 36
- update(name) // 37
- read(moderators) // 38
- add(moderators), remove(moderators) // 39
- }
- Invite{
- }
- Location{
- create //34
- update(name), update(country) //35
- }
- }
- role SYSTEM{
- // Do NOT change SYSTEM role's permissions
- Person{
- fullAccess
- }
- Event{
- fullAccess
- }
- Category{
- fullAccess
- }
- Invite{
- fullAccess
- }
- Location{
- fullAccess
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement