Improve collaboration mail.
This commit is contained in:
@@ -25,6 +25,8 @@ import com.wisemapping.exceptions.UnexpectedArgumentException;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class BaseSecurityAdvice {
|
||||
private MindmapService mindmapService = null;
|
||||
@@ -47,9 +49,9 @@ public abstract class BaseSecurityAdvice {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean isAllowed(User user, MindMap map);
|
||||
protected abstract boolean isAllowed(@Nullable User user, MindMap map);
|
||||
|
||||
protected abstract boolean isAllowed(User user, int mapId);
|
||||
protected abstract boolean isAllowed(@Nullable User user, int mapId);
|
||||
|
||||
protected MindmapService getMindmapService() {
|
||||
return mindmapService;
|
||||
|
@@ -25,6 +25,7 @@ import com.wisemapping.model.MindMap;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class UpdateSecurityAdvise
|
||||
extends BaseSecurityAdvice
|
||||
@@ -35,7 +36,7 @@ public class UpdateSecurityAdvise
|
||||
return methodInvocation.proceed();
|
||||
}
|
||||
|
||||
protected boolean isAllowed(@NotNull User user, @NotNull MindMap map) {
|
||||
protected boolean isAllowed(@Nullable User user, @NotNull MindMap map) {
|
||||
boolean result;
|
||||
if (map.getCreator() == null) {
|
||||
// This means that the map is new and is an add operation.
|
||||
@@ -46,7 +47,7 @@ public class UpdateSecurityAdvise
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, int mapId) {
|
||||
protected boolean isAllowed(@Nullable User user, int mapId) {
|
||||
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.EDITOR);
|
||||
}
|
||||
}
|
||||
|
@@ -34,11 +34,11 @@ public class ViewBaseSecurityAdvise
|
||||
return methodInvocation.proceed();
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, MindMap map) {
|
||||
protected boolean isAllowed(@NotNull User user, MindMap map) {
|
||||
return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER);
|
||||
}
|
||||
|
||||
protected boolean isAllowed(User user, int mapId) {
|
||||
protected boolean isAllowed(@NotNull User user, int mapId) {
|
||||
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.VIEWER);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user