mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Minor permissions modification.
This commit is contained in:
parent
2e2e978c43
commit
a263a05520
@ -44,6 +44,8 @@ public class MindmapServiceImpl
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
private String adminUser;
|
||||
|
||||
@Override
|
||||
public boolean hasPermissions(@Nullable User user, int mapId, @NotNull CollaborationRole grantedRole) {
|
||||
final Mindmap map = mindmapManager.getMindmapById(mapId);
|
||||
@ -54,7 +56,7 @@ public class MindmapServiceImpl
|
||||
public boolean hasPermissions(@Nullable User user, @Nullable Mindmap map, @NotNull CollaborationRole role) {
|
||||
boolean result = false;
|
||||
if (map != null) {
|
||||
if (map.isPublic() && role == CollaborationRole.VIEWER) {
|
||||
if ((map.isPublic() && role == CollaborationRole.VIEWER) || (isAdmin(user) && role == CollaborationRole.VIEWER)) {
|
||||
result = true;
|
||||
} else if (user != null) {
|
||||
final Collaboration collaboration = map.findCollaboration(user);
|
||||
@ -67,6 +69,10 @@ public class MindmapServiceImpl
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isAdmin(User user) {
|
||||
return (user != null && user.getEmail().equals(adminUser));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mindmap getMindmapByTitle(String title, User user) {
|
||||
return mindmapManager.getMindmapByTitle(title, user);
|
||||
@ -219,7 +225,6 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<MindMapHistory> findMindmapHistory(int mindmapId) {
|
||||
return mindmapManager.getHistoryFrom(mindmapId);
|
||||
@ -282,4 +287,12 @@ public class MindmapServiceImpl
|
||||
public void setNotificationService(NotificationService notificationService) {
|
||||
this.notificationService = notificationService;
|
||||
}
|
||||
|
||||
public void setAdminUser(String adminUser) {
|
||||
this.adminUser = adminUser;
|
||||
}
|
||||
|
||||
public String getAdminUser() {
|
||||
return adminUser;
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
<property name="mindmapManager" ref="mindmapManager"/>
|
||||
<property name="userService" ref="userService"/>
|
||||
<property name="notificationService" ref="notificationService"/>
|
||||
<property name="adminUser" ref="${admin.user}/>
|
||||
</bean>
|
||||
|
||||
<bean id="mindmapService"
|
||||
|
Loading…
Reference in New Issue
Block a user