Java Code Examples for org.springframework.security.acls.model.Permission#getMask()

The following examples show how to use org.springframework.security.acls.model.Permission#getMask() . 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: TenantBasedPermissionGrantedStrategy.java    From haven-platform with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isGranted(Acl acl, List<Permission> requests, List<Sid> sids, boolean administrativeMode) {
    PermissionData granted = getPermission(acl, sids);
    final int grantedMask = granted.getMask();
    boolean allow = false;
    for(Permission request: requests) {
        int reqMask = request.getMask();
        if((reqMask & grantedMask) == reqMask) {
            allow = true;
        }
        if(!allow) {
            // each false is mean disallow
            break;
        }
    }
    return allow;
}
 
Example 2
Source File: PermissionData.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
public final boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof Permission)) {
        return false;
    }
    Permission permission = (Permission) obj;
    return (this.mask == permission.getMask());
}
 
Example 3
Source File: PermissionData.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
public final boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof Permission)) {
        return false;
    }
    Permission permission = (Permission) obj;
    return (this.mask == permission.getMask());
}
 
Example 4
Source File: NextServerPermission.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object object) {
    if (object == null) {
        return false;
    }

    if (!(object instanceof Permission)) {
        return false;
    }

    Permission permission = (Permission) object;

    return (mask == permission.getMask());
}
 
Example 5
Source File: AceImpl.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
public AceImpl(Sid sid, Permission perm) {
    this(new SidInfo(sid), perm == null ? 0 : perm.getMask());
}
 
Example 6
Source File: AceImpl.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
void setPermission(Permission perm) {
    this.permissionMask = perm.getMask();
    this.perm = null;
}
 
Example 7
Source File: PermissionData.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public Builder remove(Permission permission) {
    this.mask &= ~permission.getMask();
    this.pattern = AclFormattingUtils.demergePatterns(this.pattern, permission.getPattern());

    return this;
}
 
Example 8
Source File: PermissionData.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public Builder add(Permission permission) {
    this.mask |= permission.getMask();
    this.pattern = AclFormattingUtils.mergePatterns(this.pattern, permission.getPattern());
    return this;
}
 
Example 9
Source File: PermissionData.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public static PermissionData from(Permission permission) {
    if(permission == null  || permission instanceof PermissionData) {
        return (PermissionData) permission;
    }
    return new PermissionData(permission.getPattern(), permission.getMask());
}
 
Example 10
Source File: PermissionData.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
public boolean has(Permission permission) {
    int req = permission.getMask();
    return (this.mask & req) == req;
}
 
Example 11
Source File: AceImpl.java    From kylin with Apache License 2.0 4 votes vote down vote up
public AceImpl(Sid sid, Permission perm) {
    this(new SidInfo(sid), perm == null ? 0 : perm.getMask());
}
 
Example 12
Source File: AceImpl.java    From kylin with Apache License 2.0 4 votes vote down vote up
void setPermission(Permission perm) {
    this.permissionMask = perm.getMask();
    this.perm = null;
}