Object readResolve() { return PermissionUtil.createPermission(c, n, a); } }
/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
/** * Determine if one collection implies all the permissions in the other collection. * * @param collection the collection to check against (must not be {@code null}) * @param testCollection the collection whose permissions are to be tested (must not be {@code null}) * @return {@code true} if {@code collection} implies all of the permissions in {@code testCollection}, {@code false} otherwise */ public static boolean impliesAll(PermissionCollection collection, PermissionCollection testCollection) { return forEachIn(collection, PermissionCollection::implies, testCollection); }
/** * Determine if two permission collections are equal, that is, each collection implies all of the permissions in the * other collection. * * @param pc1 the first collection (must not be {@code null}) * @param pc2 the second collection (must not be {@code null}) * @return {@code true} if the collections imply one another, {@code false} otherwise */ public static boolean equals(PermissionCollection pc1, PermissionCollection pc2) { return impliesAll(pc1, pc2) && impliesAll(pc2, pc1); }
/** * Get the actions string. The string is computed the first time this method is called, and cached thereafter. * * @return the actions string (not {@code null}) */ public final String getActions() { final String actions = this.actions; if (actions != null) { return actions; } return this.actions = PermissionUtil.toActionsString(actionBits, this::getActionName); }
/** * Parse the actions string into a bit set. * * @param actionsString the actions string * @return the bit set * @throws IllegalArgumentException if the actions string contained an invalid name or invalid syntax */ public final int parseActions(final String actionsString) throws IllegalArgumentException { return PermissionUtil.parseActions(actionsString, this::getActionBit); }
/** * Determine if two permission collections are equal, that is, each collection implies all of the permissions in the * other collection. * * @param pc1 the first collection (must not be {@code null}) * @param pc2 the second collection (must not be {@code null}) * @return {@code true} if the collections imply one another, {@code false} otherwise */ public static boolean equals(PermissionCollection pc1, PermissionCollection pc2) { return impliesAll(pc1, pc2) && impliesAll(pc2, pc1); }
/** * Get the actions string. The string is computed the first time this method is called, and cached thereafter. * * @return the actions string (not {@code null}) */ public final String getActions() { final String actions = this.actions; if (actions != null) { return actions; } return this.actions = PermissionUtil.toActionsString(actionBits, this::getActionName); }
/** * Parse the actions string into a bit set. * * @param actionsString the actions string * @return the bit set * @throws IllegalArgumentException if the actions string contained an invalid name or invalid syntax */ public final int parseActions(final String actionsString) throws IllegalArgumentException { return PermissionUtil.parseActions(actionsString, this::getActionBit); }
/** * Instantiate a permission with the given class name, permission name, and actions. * * @param classLoader the class loader to search in ({@code null} indicates the system class loader) * @param className the name of the permission class to instantiate (must not be {@code null}) * @param name the permission name (may be {@code null} if allowed by the permission class) * @param actions the permission actions (may be {@code null} if allowed by the permission class) * @return the permission object (not {@code null}) * @throws InvalidPermissionClassException if the permission class does not exist or is not valid * @throws ClassCastException if the class name does not refer to a subclass of {@link Permission} */ public static Permission createPermission(final ClassLoader classLoader, final String className, final String name, final String actions) { Assert.checkNotNullParam("className", className); final Class<? extends Permission> permissionClass; try { permissionClass = Class.forName(className, true, classLoader).asSubclass(Permission.class); } catch (ClassNotFoundException e) { throw ElytronMessages.log.permissionClassMissing(className, e); } return createPermission(permissionClass, name, actions); }
/** * Add all of the permissions from the source collection to the target collection. * * @param target the target collection (must not be {@code null}) * @param source the source collection (must not be {@code null}) * @return the target collection (not {@code null}) */ public static PermissionCollection addAll(PermissionCollection target, PermissionCollection source) { return forEachIn(source, PermissionCollection::add, target); }
/** * Determine if two permission collections are equal, that is, each collection implies all of the permissions in the * other collection. * * @param pc1 the first collection (must not be {@code null}) * @param pc2 the second collection (must not be {@code null}) * @return {@code true} if the collections imply one another, {@code false} otherwise */ public static boolean equals(PermissionCollection pc1, PermissionCollection pc2) { return impliesAll(pc1, pc2) && impliesAll(pc2, pc1); }
/** * Get the actions string. The string is computed the first time this method is called, and cached thereafter. * * @return the actions string (not {@code null}) */ public final String getActions() { final String actions = this.actions; if (actions != null) { return actions; } return this.actions = PermissionUtil.toActionsString(actionBits, this::getActionName); }
/** * Parse the actions string into a bit set. * * @param actionsString the actions string * @return the bit set * @throws IllegalArgumentException if the actions string contained an invalid name or invalid syntax */ public final int parseActions(final String actionsString) throws IllegalArgumentException { return PermissionUtil.parseActions(actionsString, this::getActionBit); }
/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
Object readResolve() { return PermissionUtil.createPermission(c, n, a); } }
/** * Determine if one collection implies all the permissions in the other collection. * * @param collection the collection to check against (must not be {@code null}) * @param testCollection the collection whose permissions are to be tested (must not be {@code null}) * @return {@code true} if {@code collection} implies all of the permissions in {@code testCollection}, {@code false} otherwise */ public static boolean impliesAll(PermissionCollection collection, PermissionCollection testCollection) { return forEachIn(collection, PermissionCollection::implies, testCollection); }
/** * Determine if two permission collections are equal, that is, each collection implies all of the permissions in the * other collection. * * @param pc1 the first collection (must not be {@code null}) * @param pc2 the second collection (must not be {@code null}) * @return {@code true} if the collections imply one another, {@code false} otherwise */ public static boolean equals(PermissionCollection pc1, PermissionCollection pc2) { return impliesAll(pc1, pc2) && impliesAll(pc2, pc1); }
/** * Get the actions string. The string is computed the first time this method is called, and cached thereafter. * * @return the actions string (not {@code null}) */ public final String getActions() { final String actions = this.actions; if (actions != null) { return actions; } return this.actions = PermissionUtil.toActionsString(actionBits, this::getActionName); }
/** * Parse the actions string into a bit set. * * @param actionsString the actions string * @return the bit set * @throws IllegalArgumentException if the actions string contained an invalid name or invalid syntax */ public final int parseActions(final String actionsString) throws IllegalArgumentException { return PermissionUtil.parseActions(actionsString, this::getActionBit); }