Simplify security model.

This commit is contained in:
Paulo Gustavo Veiga
2012-06-12 11:23:47 -03:00
parent 249080cc20
commit cbdd6dd146
25 changed files with 101 additions and 166 deletions

View File

@@ -38,7 +38,7 @@ public class Collaboration {
// Guarantee referential integrity
mindmap.addCollaboration(this);
collaborator.addMindmapUser(this);
collaborator.addCollaboration(this);
}
public long getId() {
@@ -65,18 +65,6 @@ public class Collaboration {
this.role = role;
}
public boolean isOwner() {
return getRole() == CollaborationRole.OWNER;
}
public boolean isEditor() {
return getRole() == CollaborationRole.EDITOR;
}
public boolean isViewer() {
return getRole() == CollaborationRole.VIEWER;
}
public MindMap getMindMap() {
return mindMap;
}
@@ -101,4 +89,9 @@ public class Collaboration {
public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) {
this.collaborationProperties = collaborationProperties;
}
public boolean hasPermissions(@NotNull CollaborationRole role) {
return this.getRole().ordinal() <= role.ordinal();
}
}