SEC-262: Refactor common method into superclass.

This commit is contained in:
Ben Alex 2006-05-23 11:03:30 +00:00
parent d795836bf1
commit 07e805e342
4 changed files with 12 additions and 21 deletions

View File

@ -19,6 +19,7 @@ import java.util.Iterator;
import java.util.List;
import org.acegisecurity.AccessDecisionManager;
import org.acegisecurity.AccessDeniedException;
import org.acegisecurity.AcegiMessageSource;
import org.acegisecurity.ConfigAttribute;
import org.springframework.beans.factory.InitializingBean;
@ -138,4 +139,12 @@ public abstract class AbstractAccessDecisionManager
return true;
}
protected final void checkAllowIfAllAbstainDecisions() {
if (!this.isAllowIfAllAbstainDecisions()) {
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
}
}
}

View File

@ -79,12 +79,6 @@ public class AffirmativeBased extends AbstractAccessDecisionManager {
}
// To get this far, every AccessDecisionVoter abstained
if (this.isAllowIfAllAbstainDecisions()) {
return;
} else {
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
}
checkAllowIfAllAbstainDecisions();
}
}

View File

@ -108,13 +108,7 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
}
// To get this far, every AccessDecisionVoter abstained
if (this.isAllowIfAllAbstainDecisions()) {
return;
} else {
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
}
checkAllowIfAllAbstainDecisions();
}
public boolean isAllowIfEqualGrantedDeniedDecisions() {

View File

@ -106,12 +106,6 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
}
// To get this far, every AccessDecisionVoter abstained
if (this.isAllowIfAllAbstainDecisions()) {
return;
} else {
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
}
checkAllowIfAllAbstainDecisions();
}
}