public boolean implies(final Permission permission) { for (Permission test : permissionsRef.get()) { if (test.implies(permission)) { return true; } } return false; }
public boolean implies(final Permission permission) { for (Permission test : permissionsRef.get()) { if (test.implies(permission)) { return true; } } return false; }
/** * Checks if this DeploymentCustomizerPermission would imply the parameter * permission. This permission implies another * DeploymentCustomizerPermission permission if: * * <ul> * <li>both of them has the "privatearea" action (other actions are not * allowed) and</li> * <li>their filters (only name attribute is allowed in the filters) match * similarly to {@link DeploymentAdminPermission}.</li> * </ul> * * The value of the name attribute means Bundle Symbolic Name and not * Deployment Package Symbolic Name here! * <p> * * @param permission Permission to check. * @return true if this DeploymentCustomizerPermission object implies the * specified permission. * @see java.security.Permission#implies(java.security.Permission) */ public boolean implies(Permission permission) { if (!(permission instanceof DeploymentCustomizerPermission)) return false; DeploymentCustomizerPermission dcp = (DeploymentCustomizerPermission) permission; return delegate.implies(dcp.delegate); }
return delegate.implies(dap.delegate);
@Override public boolean implies(Permission p) { for (Permission perm : perms) { if (perm.implies(p)) { return true; } } return false; } @Override
public boolean implies(final Permission permission) { if (permission == null || getSourcePermission().getClass() != permission.getClass()) { return false; } final Permission all = this.all; if (all != null) { return all.implies(permission); } final Permission ourPermission = byName.get(permission.getName()); return ourPermission != null && ourPermission.implies(permission); } }
/** * Indicates whether the argument permission is implied by the permissions * contained in the receiver. * * @return boolean <code>true</code> if the argument permission is implied * by the permissions in the receiver, and <code>false</code> if * it is not. * @param permission * java.security.Permission the permission to check */ public boolean implies(Permission permission) { for (Enumeration elements = elements(); elements.hasMoreElements();) { if (((Permission)elements.nextElement()).implies(permission)) { return true; } } return false; } }
/** * Try a permission check. Any violations will be logged to the {@code org.wildfly.security.access} category * at a {@code DEBUG} level. * * @param permission the permission to check * @param domains the protection domains to try * @return {@code true} if the access check succeeded, {@code false} otherwise */ public static boolean tryCheckPermission(final Permission permission, final ProtectionDomain... domains) { if (permission.implies(SECURITY_MANAGER_PERMISSION)) { return false; } final Context ctx = CTX.get(); if (ctx.checking) { if (ctx.entered) { return true; } ctx.entered = true; try { final ProtectionDomain deniedDomain = findAccessDenial(permission, domains); if (deniedDomain != null) { return false; } } finally { ctx.entered = false; } } return true; }
/** * Adds a permission to the DmtPrincipalPermissionCollection. * * @param permission the Permission object to add * @exception IllegalArgumentException if the permission is not a * DmtPrincipalPermission * @exception SecurityException if this DmtPrincipalPermissionCollection * object has been marked readonly */ public void add(Permission permission) { if (!(permission instanceof DmtPrincipalPermission)) throw new IllegalArgumentException("Cannot add permission, invalid permission type: " + permission); if (isReadOnly()) throw new SecurityException("Cannot add permission, collection is marked read-only."); // only add new permission if it is not already implied by the // permissions in the collection if (!implies(permission)) { // remove all permissions that are implied by the new one Iterator i = perms.iterator(); while (i.hasNext()) if (permission.implies((DmtPrincipalPermission) i.next())) i.remove(); // no need to synchronize because all adds are done sequentially // before any implies() calls perms.add(permission); } }
/** * Adds a permission to the DmtAlertPermissionCollection. * * @param permission the Permission object to add * @exception IllegalArgumentException if the permission is not a * AlertPermission * @exception SecurityException if this DmtAlertPermissionCollection object * has been marked readonly */ public void add(Permission permission) { if (!(permission instanceof AlertPermission)) throw new IllegalArgumentException("Cannot add permission, invalid permission type: " + permission); if (isReadOnly()) throw new SecurityException("Cannot add permission, collection is marked read-only."); // only add new permission if it is not already implied by the // permissions in the collection if (!implies(permission)) { // remove all permissions that are implied by the new one Iterator i = perms.iterator(); while (i.hasNext()) if (permission.implies((AlertPermission) i.next())) i.remove(); // no need to synchronize because all adds are done sequentially // before any implies() calls perms.add(permission); } }
public boolean implies(Permission p) { for (Iterator<Permission> i = perms.iterator(); i.hasNext();) { if (((Permission) i.next()).implies(p)) { return true; } } return false; }
oldVal = readVal; for (Permission test : oldVal) { if (test.implies(permission)) { return;
if (perm.implies(SECURITY_MANAGER_PERMISSION)) { throw access.secMgrChange();
protected void executeScript(Class scriptClass, Permission missingPermission) { try { Script script = InvokerHelper.createScript(scriptClass, new Binding()); script.run(); //InvokerHelper.runScript(scriptClass, null); } catch (AccessControlException ace) { if (missingPermission != null && missingPermission.implies(ace.getPermission())) { return; } else { fail(ace.toString()); } } if (missingPermission != null) { fail("Should catch an AccessControlException"); } }
/** * Checks if this DeploymentCustomizerPermission would imply the parameter permission. * This permission implies another DeploymentCustomizerPermission permission if: * * <ul> * <li>both of them has the "privatearea" action (other actions are not allowed) and</li> * <li>their filters (only name attribute is allowed in the filters) match similarly to * {@link DeploymentAdminPermission}.</li> * </ul> * * The value of the name attribute means Bundle Symbolic Name and not Deployment Package * Symbolic Name here!<p> * * @param permission Permission to check. * @return true if this DeploymentCustomizerPermission object implies the * specified permission. * @see java.security.Permission#implies(java.security.Permission) */ public boolean implies(Permission permission) { if (!(permission instanceof DeploymentCustomizerPermission)) return false; DeploymentCustomizerPermission dcp = (DeploymentCustomizerPermission) permission; return delegate.implies(dcp.delegate); }
@Override public final boolean implies(Permission permission) { return preImplies.test(permission) && badDefaultPermission.implies(permission); }
if (failure.thrownException() instanceof AccessControlException) { AccessControlException ace = (AccessControlException) failure.thrownException(); if (missingPermission.implies(ace.getPermission())) { continue;
/** * Adds a permission to the DmtPrincipalPermissionCollection. * * @param permission the Permission object to add * @exception IllegalArgumentException if the permission is not a * DmtPrincipalPermission * @exception SecurityException if this DmtPrincipalPermissionCollection * object has been marked readonly */ public void add(Permission permission) { if (!(permission instanceof DmtPrincipalPermission)) throw new IllegalArgumentException( "Cannot add permission, invalid permission type: " + permission); if (isReadOnly()) throw new SecurityException( "Cannot add permission, collection is marked read-only."); // only add new permission if it is not already implied by the // permissions in the collection if (!implies(permission)) { // remove all permissions that are implied by the new one Iterator i = perms.iterator(); while (i.hasNext()) if (permission.implies((DmtPrincipalPermission) i.next())) i.remove(); // no need to synchronize because all adds are done sequentially // before any implies() calls perms.add(permission); } }
/** * Adds a permission to the DmtAlertPermissionCollection. * * @param permission the Permission object to add * @exception IllegalArgumentException if the permission is not a * AlertPermission * @exception SecurityException if this DmtAlertPermissionCollection object * has been marked readonly */ public void add(Permission permission) { if (!(permission instanceof AlertPermission)) throw new IllegalArgumentException( "Cannot add permission, invalid permission type: " + permission); if (isReadOnly()) throw new SecurityException( "Cannot add permission, collection is marked read-only."); // only add new permission if it is not already implied by the // permissions in the collection if (!implies(permission)) { // remove all permissions that are implied by the new one Iterator i = perms.iterator(); while (i.hasNext()) if (permission.implies((AlertPermission) i.next())) i.remove(); // no need to synchronize because all adds are done sequentially // before any implies() calls perms.add(permission); } }