org.springframework.security.access.expression.method.MethodSecurityExpressionOperations Java Examples

The following examples show how to use org.springframework.security.access.expression.method.MethodSecurityExpressionOperations. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PermissionExpressionHandler.java    From zhcet-web with Apache License 2.0 5 votes vote down vote up
@Override
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) {
    DomainPermissionExpression root = new DomainPermissionExpression(authentication);
    root.setPermissionEvaluator(getPermissionEvaluator());
    root.setTrustResolver(this.trustResolver);
    root.setRoleHierarchy(getRoleHierarchy());
    return root;
}
 
Example #2
Source File: PermissionService.java    From galeb with Apache License 2.0 5 votes vote down vote up
public boolean allowSave(Object criteria, MethodSecurityExpressionOperations expressionOperations) {
    Action action = Action.UPDATE;
    if (criteria instanceof AbstractEntity) {
        AbstractEntity entity = (AbstractEntity) criteria;
        action = entity.getId() != 0 ? Action.UPDATE : Action.CREATE;
    }

    return allow(action, criteria, expressionOperations);
}
 
Example #3
Source File: PlatformSecurityExpressionHandler.java    From abixen-platform with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) {
    PlatformMethodSecurityExpressionRoot root = new PlatformMethodSecurityExpressionRoot(authentication);
    root.setThis(invocation.getThis());
    root.setPermissionEvaluator(this.getPermissionEvaluator());
    return root;
}
 
Example #4
Source File: CustomMethodSecurityExpressionHandler.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(
        Authentication authentication, MethodInvocation invocation) {
    CustomMethodSecurityExpressionRoot root =
            new CustomMethodSecurityExpressionRoot(rubricRepository, criterionRepository, ratingRepository,
                    evaluationRepository, toolItemRubricAssociationRepository, securityService, authentication);
    root.setPermissionEvaluator(getPermissionEvaluator());
    root.setTrustResolver(this.trustResolver);
    root.setRoleHierarchy(getRoleHierarchy());
    return root;
}
 
Example #5
Source File: UniTimeSecurityExpressionHandler.java    From unitime with Apache License 2.0 5 votes vote down vote up
@Override
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) {
	MyMethodSecurityExpressionRoot root = new MyMethodSecurityExpressionRoot(authentication);
    root.setThis(invocation.getThis());
    root.setPermissionEvaluator(getPermissionEvaluator());
    
    return root;
}
 
Example #6
Source File: CustomMethodSecurityExpressionHandler.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(
        Authentication authentication, MethodInvocation invocation) {
    CustomMethodSecurityExpressionRoot root =
            new CustomMethodSecurityExpressionRoot(rubricRepository, criterionRepository, ratingRepository,
                    evaluationRepository, toolItemRubricAssociationRepository, securityService, authentication);
    root.setPermissionEvaluator(getPermissionEvaluator());
    root.setTrustResolver(this.trustResolver);
    root.setRoleHierarchy(getRoleHierarchy());
    return root;
}
 
Example #7
Source File: CustomMethodSecurityExpressionHandler.java    From tutorials with MIT License 5 votes vote down vote up
@Override
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(Authentication authentication, MethodInvocation invocation) {
    // final CustomMethodSecurityExpressionRoot root = new CustomMethodSecurityExpressionRoot(authentication);
    final MySecurityExpressionRoot root = new MySecurityExpressionRoot(authentication);
    root.setPermissionEvaluator(getPermissionEvaluator());
    root.setTrustResolver(this.trustResolver);
    root.setRoleHierarchy(getRoleHierarchy());
    return root;
}
 
Example #8
Source File: PermissionService.java    From galeb with Apache License 2.0 4 votes vote down vote up
public boolean allowDelete(Object criteria, MethodSecurityExpressionOperations expressionOperations) {
    return allow(Action.DELETE, criteria, expressionOperations);
}
 
Example #9
Source File: PermissionService.java    From galeb with Apache License 2.0 4 votes vote down vote up
public boolean allowView(Object criteria, MethodSecurityExpressionOperations expressionOperations) {
    return allow(Action.VIEW, criteria, expressionOperations);
}