mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-19 20:20:43 +02:00
Add admin as permissions for finding.
This commit is contained in:
parent
e36b0b8b52
commit
057d5bc01f
@ -135,8 +135,7 @@ public class AdminController extends BaseController {
|
|||||||
|
|
||||||
for (int i = 0; i < muid; i++) {
|
for (int i = 0; i < muid; i++) {
|
||||||
System.out.println("Looking for user:" + i);
|
System.out.println("Looking for user:" + i);
|
||||||
User user = user = userService.getUserBy(i);
|
final User user = userService.getUserBy(i);
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
// Do not process admin accounts ...
|
// Do not process admin accounts ...
|
||||||
if (user.getEmail().contains("wisemapping")) {
|
if (user.getEmail().contains("wisemapping")) {
|
||||||
|
@ -24,6 +24,7 @@ import com.wisemapping.model.User;
|
|||||||
import com.wisemapping.exceptions.AccessDeniedSecurityException;
|
import com.wisemapping.exceptions.AccessDeniedSecurityException;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
|
import com.wisemapping.service.MindmapServiceImpl;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ public abstract class BaseSecurityAdvice {
|
|||||||
isAllowed = isAllowed(user, ((Integer) argument));
|
isAllowed = isAllowed(user, ((Integer) argument));
|
||||||
} else if (argument instanceof Collaborator) {
|
} else if (argument instanceof Collaborator) {
|
||||||
// Read operation find on the user are allowed ...
|
// Read operation find on the user are allowed ...
|
||||||
isAllowed = user.identityEquality((Collaborator) argument);
|
isAllowed = user.identityEquality((Collaborator) argument) || ((MindmapServiceImpl) mindmapService).isAdmin(user);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Argument " + argument);
|
throw new IllegalArgumentException("Argument " + argument);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class MindmapServiceImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAdmin(User user) {
|
public boolean isAdmin(@Nullable User user) {
|
||||||
return user != null && user.getEmail() != null && user.getEmail().equals(adminUser);
|
return user != null && user.getEmail() != null && user.getEmail().equals(adminUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import com.wisemapping.mail.NotificationService;
|
|||||||
import com.wisemapping.model.*;
|
import com.wisemapping.model.*;
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||||
@ -181,6 +182,7 @@ public class UserServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public User getUserBy(long id) {
|
public User getUserBy(long id) {
|
||||||
return userManager.getUserBy(id);
|
return userManager.getUserBy(id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user