Example usage for java.security Permission equals

List of usage examples for java.security Permission equals

Introduction

In this page you can find the example usage for java.security Permission equals.

Prototype


public abstract boolean equals(Object obj);

Source Link

Document

Checks two Permission objects for equality.

Usage

From source file:org.jboss.dashboard.security.UIPolicy.java

public synchronized void removePermission(Principal p, Permission perm) {
    // Update buffers
    PermissionDescriptor pd = PermissionManager.lookup().find(p, perm);
    if (pd != null && !pd.isReadonly()) {
        int pos = updateBuffer.indexOf(pd);
        if (pos != -1)
            updateBuffer.remove(pos);/*w w  w.ja va  2s .  co  m*/
        pos = deleteBuffer.indexOf(pd);
        if (pos == -1)
            deleteBuffer.add(pd);

        // Remove the permission from memory
        if (log.isDebugEnabled())
            log.debug("Removing permission " + perm + " for principal " + p);
        Permissions prpalPermissions = (Permissions) permissionMap.get(p);
        if (prpalPermissions != null) {
            Permissions newPermissions = new Permissions();
            Enumeration en = prpalPermissions.elements();
            while (en.hasMoreElements()) {
                Permission permission = (Permission) en.nextElement();
                if (!perm.equals(permission))
                    newPermissions.add(permission);
            }
            permissionMap.put(p, newPermissions);
        }
    }
}