19 package org.turro.security;
21 import java.util.Collection;
22 import org.turro.string.Strings;
23 import org.turro.action.Contacts;
24 import org.turro.actor.Actors;
25 import org.turro.entities.IElephantEntity;
26 import org.turro.plugin.contacts.IContact;
27 import org.turro.script.Scripting;
28 import org.turro.util.Cached;
36 public static final String
38 COORDINATOR =
"coordinator",
39 BENEFICIARY =
"beneficiary",
41 RESEARCH =
"research",
44 CONSORTIUM =
"consortium",
47 PROPOSALS =
"proposals",
48 MILESTONES =
"milestones",
52 DELIVERABLES =
"deliverables";
54 private final transient String name;
55 private final boolean allow;
57 private boolean show =
true;
58 private String showRole, actionRole;
59 private String showScript, actionScript;
60 private String showActor, actionActor;
61 private Integer max, order;
91 this.actionRole = role;
96 this.showScript = script;
101 this.actionScript = script;
106 this.showActor = actor;
111 this.actionActor = actor;
116 this.permissions.
put(permission);
141 return permissions.
get(name, iee);
156 (Strings.isBlank(showRole) || contact.
isInRole(showRole)) &&
157 (Strings.isBlank(showScript) || processScript(showScript, iee)) &&
158 (Strings.isBlank(showActor) || processActor(showActor, iee));
162 return canAct(contact.get());
167 (Strings.isBlank(actionRole) || contact.
isInRole(actionRole)) &&
168 (Strings.isBlank(actionScript) || processScript(actionScript, iee)) &&
169 (Strings.isBlank(actionActor) || processActor(actionActor, iee));
178 private boolean processActor(String actor, IElephantEntity entity) {
179 return Actors.isActorFor(contact.get(), entity, actor);
184 private transient Cached<IContact> contact;
185 private transient IElephantEntity iee;
189 this.contact = contact;
static boolean evalFor(Object entity, String value)
Collection< String > concepts()
ConceptPermission put(String key, ConceptPermission value)
ConceptPermission get(Object key)
ConceptPermission max(Integer max)
boolean canAct(IContact contact)
ConceptPermission showRole(String role)
Collection< String > getConcepts()
ConceptPermission actionRole(String role)
ConceptPermission showScript(String script)
ConceptPermission actionActor(String actor)
ConceptPermission getPermission(String name)
static final String DRIVER
ConceptPermission actionScript(String script)
boolean canShow(IContact contact)
ConceptPermission addPermission(ConceptPermission permission)
ConceptPermission order(Integer order)
static ConceptPermission allow(String name)
static ConceptPermission forbid(String name)
ConceptPermission showActor(String actor)
void init(IElephantEntity iee, Cached< IContact > contact)
boolean isInRole(String role)