@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ManagementPermission that = (ManagementPermission) o; return getActionEffect() == that.getActionEffect(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ManagementPermission that = (ManagementPermission) o; return getActionEffect() == that.getActionEffect(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ManagementPermission that = (ManagementPermission) o; return getActionEffect() == that.getActionEffect(); }
@Override public String getActions() { Set<Action.ActionEffect> effects = new TreeSet<Action.ActionEffect>(); for (ManagementPermission permission : underlyingPermissions.values()) { effects.add(permission.getActionEffect()); } boolean first = true; StringBuilder sb = new StringBuilder(); for (Action.ActionEffect effect : effects) { if (!first) { sb.append(','); } else { first = false; } sb.append(effect.toString()); } return sb.toString(); }
@Override public String getActions() { Set<Action.ActionEffect> effects = new TreeSet<Action.ActionEffect>(); for (ManagementPermission permission : underlyingPermissions.values()) { effects.add(permission.getActionEffect()); } boolean first = true; StringBuilder sb = new StringBuilder(); for (Action.ActionEffect effect : effects) { if (!first) { sb.append(','); } else { first = false; } sb.append(effect.toString()); } return sb.toString(); }
@Override public String getActions() { Set<Action.ActionEffect> effects = new TreeSet<Action.ActionEffect>(); for (ManagementPermission permission : underlyingPermissions.values()) { effects.add(permission.getActionEffect()); } boolean first = true; StringBuilder sb = new StringBuilder(); for (Action.ActionEffect effect : effects) { if (!first) { sb.append(','); } else { first = false; } sb.append(effect.toString()); } return sb.toString(); }
@Override public void add(Permission permission) { if (isReadOnly()) { throw ControllerLogger.ROOT_LOGGER.permissionCollectionIsReadOnly(); } if (type.equals(permission.getClass())) { ManagementPermission mperm = (ManagementPermission) permission; synchronized (permissions) { permissions.put(mperm.getActionEffect(), mperm); } } else { throw ControllerLogger.ROOT_LOGGER.incompatiblePermissionType(permission.getClass()); } }
/** * Adds a permission. * <p> * This method should not be called after the instance has been made visible to another thread * than the one that constructed it. * </p> * @param permissionName name of the permission to add. Cannot be {@code null} * @param underlyingPermission the permission. Cannot be {@code null} */ public void addUnderlyingPermission(String permissionName, ManagementPermission underlyingPermission) { assert underlyingPermission.getActionEffect() == getActionEffect() : "incompatible ActionEffect"; if (combinationPolicy == CombinationPolicy.REJECTING && underlyingPermissions.size() > 0) { throw ControllerLogger.ROOT_LOGGER.illegalMultipleRoles(); } underlyingPermissions.put(permissionName, underlyingPermission); }
@Override public void add(Permission permission) { if (isReadOnly()) { throw ControllerMessages.MESSAGES.permissionCollectionIsReadOnly(); } if (type.equals(permission.getClass())) { ManagementPermission mperm = (ManagementPermission) permission; synchronized (permissions) { permissions.put(mperm.getActionEffect(), mperm); } } else { throw ControllerMessages.MESSAGES.incompatiblePermissionType(permission.getClass()); } }
/** * Adds a permission. * <p> * This method should not be called after the instance has been made visible to another thread * than the one that constructed it. * </p> * @param permissionName name of the permission to add. Cannot be {@code null} * @param underlyingPermission the permission. Cannot be {@code null} */ public void addUnderlyingPermission(String permissionName, ManagementPermission underlyingPermission) { assert underlyingPermission.getActionEffect() == getActionEffect() : "incompatible ActionEffect"; if (combinationPolicy == CombinationPolicy.REJECTING && underlyingPermissions.size() > 0) { throw ControllerLogger.ROOT_LOGGER.illegalMultipleRoles(); } underlyingPermissions.put(permissionName, underlyingPermission); }
@Override public void add(Permission permission) { if (isReadOnly()) { throw ControllerLogger.ROOT_LOGGER.permissionCollectionIsReadOnly(); } if (type.equals(permission.getClass())) { ManagementPermission mperm = (ManagementPermission) permission; synchronized (permissions) { permissions.put(mperm.getActionEffect(), mperm); } } else { throw ControllerLogger.ROOT_LOGGER.incompatiblePermissionType(permission.getClass()); } }
/** * Adds a permission. * <p> * This method should not be called after the instance has been made visible to another thread * than the one that constructed it. * </p> * @param permissionName name of the permission to add. Cannot be {@code null} * @param underlyingPermission the permission. Cannot be {@code null} */ public void addUnderlyingPermission(String permissionName, ManagementPermission underlyingPermission) { assert underlyingPermission.getActionEffect() == getActionEffect() : "incompatible ActionEffect"; if (combinationPolicy == CombinationPolicy.REJECTING && underlyingPermissions.size() > 0) { throw ControllerMessages.MESSAGES.illegalMultipleRoles(); } underlyingPermissions.put(permissionName, underlyingPermission); }
@Override public boolean implies(Permission permission) { if (permission instanceof ManagementPermission) { ManagementPermission mperm = (ManagementPermission) permission; Action.ActionEffect actionEffect = mperm.getActionEffect(); ManagementPermission provided; synchronized (permissions) { provided = permissions.get(actionEffect); } if (provided == null) { ControllerLogger.ACCESS_LOGGER.tracef("Permission collection '%s' does not provide a permission for %s", name, actionEffect); return false; } else if (!provided.implies(mperm)) { ControllerLogger.ACCESS_LOGGER.tracef("Permission provided in collection '%s' for action %s does not imply the requested permission", name, actionEffect); return false; } return true; } ControllerLogger.ACCESS_LOGGER.tracef("Permission collection %s does not imply %s as it is not a ManagementPermission", name, permission); return false; }
@Override public boolean implies(Permission permission) { if (permission instanceof ManagementPermission) { ManagementPermission mperm = (ManagementPermission) permission; Action.ActionEffect actionEffect = mperm.getActionEffect(); ManagementPermission provided; synchronized (permissions) { provided = permissions.get(actionEffect); } if (provided == null) { ControllerLogger.ACCESS_LOGGER.tracef("Permission collection '%s' does not provide a permission for %s", name, actionEffect); return false; } else if (!provided.implies(mperm)) { ControllerLogger.ACCESS_LOGGER.tracef("Permission provided in collection '%s' for action %s does not imply the requested permission", name, actionEffect); return false; } return true; } ControllerLogger.ACCESS_LOGGER.tracef("Permission collection %s does not imply %s as it is not a ManagementPermission", name, permission); return false; }
@Override public boolean implies(Permission permission) { if (permission instanceof ManagementPermission) { ManagementPermission mperm = (ManagementPermission) permission; Action.ActionEffect actionEffect = mperm.getActionEffect(); ManagementPermission provided; synchronized (permissions) { provided = permissions.get(actionEffect); } if (provided == null) { ControllerLogger.ACCESS_LOGGER.tracef("Permission collection '%s' does not provide a permission for %s", name, actionEffect); return false; } else if (!provided.implies(mperm)) { ControllerLogger.ACCESS_LOGGER.tracef("Permission provided in collection '%s' for action %s does not imply the requested permission", name, actionEffect); return false; } return true; } ControllerLogger.ACCESS_LOGGER.tracef("Permission collection %s does not imply %s as it is not a ManagementPermission", name, permission); return false; }
while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = new CombinationManagementPermission(combinationPolicy, actionEffect); cmp.addUnderlyingPermission(firstName, mperm); while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = combined.get(actionEffect); if (cmp == null) {
while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = new CombinationManagementPermission(combinationPolicy, actionEffect); cmp.addUnderlyingPermission(firstName, mperm); while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = combined.get(actionEffect); if (cmp == null) {
while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = new CombinationManagementPermission(combinationPolicy, actionEffect); cmp.addUnderlyingPermission(firstName, mperm); while (permissionEnumeration.hasMoreElements()) { ManagementPermission mperm = (ManagementPermission) permissionEnumeration.nextElement(); Action.ActionEffect actionEffect = mperm.getActionEffect(); CombinationManagementPermission cmp = combined.get(actionEffect); if (cmp == null) {