@Override public boolean isPermitted(ParticipantId participant, Capability capability) { Role role = getRole(participant); return role.isPermitted(capability); }
@Override public String toString(Role x) { return x == null ? null : x.toString(); } };
@Override public Role fromString(String s) { return Role.valueOf(s); }
@Override public void assign(ParticipantId participant, Role role) { Preconditions.checkNotNull(role, "Can't assign null"); Role currentRole = getRole(participant); if (!currentRole.equals(role)) { BasicAssignment assignment = assignments.get(participant.getAddress()); if (assignment == null) { assignment = new BasicAssignment(participant, role); assignments.put(participant.getAddress(), assignment); } else { assignment.setRole(role); } fireOnChanged(); } } }
for (ParticipantId participantId : wavelet.getParticipantIds()) { waveletData.setParticipantRole(participantId.getAddress(), roles.getRole(participantId).name());
@Override public void assign(ParticipantId participant, Role role) { Role roleToSet = role.equals(Policies.DEFAULT_ROLE) ? null : role; ObservableAssignment assignment = null; for (ObservableAssignment candidate : assignments.getValues()) { if (candidate.getParticipant().equals(participant)) { assignment = candidate; } } if (assignment != null) { assignment.setRole(roleToSet); } else if (roleToSet != null) { assignments.add(new DocumentBasedAssignment.AssignmentInitializer( new BasicAssignment(participant, roleToSet))); } }
@Override public boolean isPermitted(ParticipantId participant, Capability capability) { return getRole(participant).isPermitted(capability); }