Simplify security model.
This commit is contained in:
@@ -30,8 +30,6 @@ public class UpdateSecurityAdvise
|
||||
extends BaseSecurityAdvice
|
||||
implements MethodInterceptor {
|
||||
|
||||
private CollaborationRole grantedRole = CollaborationRole.EDITOR;
|
||||
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
checkRole(methodInvocation);
|
||||
return methodInvocation.proceed();
|
||||
@@ -39,16 +37,16 @@ public class UpdateSecurityAdvise
|
||||
|
||||
protected boolean isAllowed(@NotNull User user, @NotNull MindMap map) {
|
||||
boolean result;
|
||||
if (map.getOwner() == null) {
|
||||
if (map.getCreator() == null) {
|
||||
// This means that the map is new and is an add operation.
|
||||
result = true;
|
||||
} else {
|
||||
result = getMindmapService().isAllowedToView(user, map, grantedRole);
|
||||
result = getMindmapService().hasPermissions(user, map, CollaborationRole.EDITOR);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, int mapId) {
|
||||
return getMindmapService().isAllowedToView(user, mapId, grantedRole);
|
||||
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.EDITOR);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class ViewBaseSecurityAdvise
|
||||
extends BaseSecurityAdvice
|
||||
implements MethodInterceptor {
|
||||
private CollaborationRole grantedRole = CollaborationRole.VIEWER;
|
||||
|
||||
public Object invoke(@NotNull MethodInvocation methodInvocation) throws Throwable {
|
||||
checkRole(methodInvocation);
|
||||
@@ -36,10 +35,10 @@ public class ViewBaseSecurityAdvise
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, MindMap map) {
|
||||
return getMindmapService().isAllowedToView(user, map, grantedRole);
|
||||
return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER);
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, int mapId) {
|
||||
return getMindmapService().isAllowedToView(user, mapId, grantedRole);
|
||||
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.VIEWER);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user