Change symblink to moootols

Add editor issue.
This commit is contained in:
Paulo Gustavo Veiga
2012-04-02 14:11:28 -03:00
parent 9f0557b851
commit f52f01a6b1
24 changed files with 411 additions and 599 deletions

View File

@@ -29,43 +29,35 @@ import org.aopalliance.intercept.MethodInvocation;
public abstract class BaseSecurityAdvice {
private MindmapService mindmapService = null;
public void checkRole(MethodInvocation methodInvocation) throws UnexpectedArgumentException,AccessDeniedSecurityException
{
public void checkRole(MethodInvocation methodInvocation) throws UnexpectedArgumentException, AccessDeniedSecurityException {
final User user = Utils.getUser();
final Object argument = methodInvocation.getArguments()[0];
boolean isAllowed;
if (argument instanceof MindMap)
{
isAllowed = isAllowed(user,(MindMap) argument);
}
else if (argument instanceof Integer)
{
isAllowed = isAllowed(user, ((Integer)argument));
}
else
{
throw new UnexpectedArgumentException("Argument " +argument);
if (argument instanceof MindMap) {
isAllowed = isAllowed(user, (MindMap) argument);
} else if (argument instanceof Integer) {
isAllowed = isAllowed(user, ((Integer) argument));
} else {
throw new UnexpectedArgumentException("Argument " + argument);
}
if (!isAllowed)
{
throw new AccessDeniedSecurityException("User not allowed to invoke:" + methodInvocation);
if (!isAllowed) {
throw new AccessDeniedSecurityException("User '" + user.getEmail() + "' not allowed to invoke:" + methodInvocation);
}
}
protected abstract boolean isAllowed(User user, MindMap map);
protected abstract boolean isAllowed(User user, int mapId);
protected MindmapService getMindmapService()
{
protected MindmapService getMindmapService() {
return mindmapService;
}
public void setMindmapService(MindmapService service)
{
public void setMindmapService(MindmapService service) {
this.mindmapService = service;
}
}