Example usage for org.springframework.security.acls.model Permission equals

List of usage examples for org.springframework.security.acls.model Permission equals

Introduction

In this page you can find the example usage for org.springframework.security.acls.model Permission equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:com.trailmagic.image.security.SpringSecurityImageSecurityService.java

private int indexOf(Sid recipient, Permission permission, MutableAcl acl) {
    final List<AccessControlEntry> entries = acl.getEntries();
    for (int i = 0; i < entries.size(); i++) {
        final AccessControlEntry entry = entries.get(i);
        if (entry.getSid().equals(recipient) && permission.equals(entry.getPermission())) {
            return i;
        }/* w w  w  .j  a v  a  2  s . c o  m*/
    }
    return -1;
}

From source file:org.jtalks.jcommune.service.security.acl.AclGroupPermissionEvaluator.java

/**
 * Check if this <tt>permission</tt> is granted for specified <tt>sid</tt>
 *
 * @param sid                 sid to check permission for it
 * @param ace                 entry with security information (for sids)
 * @param permission          permission to check
 * @param isCheckAllowedGrant flag that indicates what type of grant need to
 *                            be checked  - 'allowed' (true) or 'restricted' (false)
 * @return <code>true</code> if this entry has specified <tt>permission</tt>
 *         and type of grant.// w w  w .  ja  va  2 s  .  c  o  m
 */
private boolean isGrantedForSid(Sid sid, AccessControlEntry ace, Permission permission,
        boolean isCheckAllowedGrant) {
    return ace.isGranting() == isCheckAllowedGrant && permission.equals(ace.getPermission())
            && ((UniversalSid) sid).getSidId().equals(((UniversalSid) ace.getSid()).getSidId());
}

From source file:org.jtalks.jcommune.service.security.acl.AclGroupPermissionEvaluator.java

/**
 * Check if this <tt>permission</tt> is granted for any <tt>authority's</tt>
 * group.//from w  w  w  .ja v  a  2 s . c  om
 *
 * @param ace                 entry with security information (for groups)
 * @param permission          permission to check
 * @param isCheckAllowedGrant flag that indicates what type of grant need to
 *                            be checked  - 'allowed' (true) or 'restricted' (false)
 * @return <code>true</code> if this entry has specified <tt>permission</tt>
 *         and type of grant.
 */
private boolean isGrantedForGroup(GroupAce ace, Permission permission, boolean isCheckAllowedGrant) {
    Permission permissionToComapare = ace.getPermission();
    if (permissionToComapare == null) {
        permissionToComapare = pluginPermissionManager
                .findPluginsBranchPermissionByMask(ace.getPermissionMask());
    }
    return ace.isGranting() == isCheckAllowedGrant && permission.equals(permissionToComapare);
}

From source file:org.jtalks.jcommune.service.security.AclGroupPermissionEvaluator.java

/**
 * Check if this <tt>permission</tt> is granted for specified <tt>sid</tt>
 *
 * @param sid                 sid to check permission for it
 * @param ace                 entry with security information (for sids)
 * @param permission          permission to check
 * @param isCheckAllowedGrant flag that indicates what type of grant need to
 *                            be checked  - 'allowed' (true) or 'restricted' (false)
 * @return <code>true</code> if this entry has specified <tt>permission</tt>
 *         and type of grant./*from   ww  w .  j a  va2s  .  c  o m*/
 */
private boolean isGrantedForSid(Sid sid, AccessControlEntry ace, Permission permission,
        boolean isCheckAllowedGrant) {
    return ((UniversalSid) sid).getSidId().equals(((UniversalSid) ace.getSid()).getSidId())
            && permission.equals(ace.getPermission()) && (ace.isGranting() == isCheckAllowedGrant);
}

From source file:org.jtalks.jcommune.service.security.AclGroupPermissionEvaluator.java

/**
 * Check if this <tt>permission</tt> is granted for any <tt>authority's</tt>
 * group.//from  w w  w.  j a  v a2  s . co m
 *
 * @param ace                 entry with security information (for groups)
 * @param authentication      authentication to check permission for it
 * @param permission          permission to check
 * @param isCheckAllowedGrant flag that indicates what type of grant need to
 *                            be checked  - 'allowed' (true) or 'restricted' (false)
 * @return <code>true</code> if this entry has specified <tt>permission</tt>
 *         and type of grant.
 */
private boolean isGrantedForGroup(GroupAce ace, Authentication authentication, Permission permission,
        boolean isCheckAllowedGrant) {
    Permission permissionToComapare = ace.getPermission();
    if (permissionToComapare == null) {
        permissionToComapare = pluginPermissionManager
                .findPluginsBranchPermissionByMask(ace.getPermissionMask());
    }
    return ace.isGranting() == isCheckAllowedGrant && permission.equals(permissionToComapare)
            && ace.getGroup(groupDao).getUsers().contains(authentication.getPrincipal());
}