/** * Test whether the subject is permitted to perform an action given as the * given permission string. * * <p>This must return the same value as {@link #hasPermission(Set, String)} * using {@link #getActiveContexts()}.</p> * * @param permission The permission string * @return True if permission is granted */ default boolean hasPermission(String permission) { return hasPermission(getActiveContexts(), permission); }
/** * Gets the value of a given option in the subject's current context. * * <p>This must return the same value as {@link #getOption(Set, String)} * using {@link #getActiveContexts()}.</p> * * @param key The key to get an option by. Case-insensitive. * @return The value of the option, if any is present */ default Optional<String> getOption(String key) { return getOption(getActiveContexts(), key); } }
/** * Return all parents that this group has in its current context * combination. * * <p>This must include inherited values if the permissions * service supports inheritance.</p> * * <p>It must also must return the same value as {@link #getParents(Set)} * using {@link #getActiveContexts()}.</p> * * @return An immutable list of parents */ default List<SubjectReference> getParents() { return getParents(getActiveContexts()); }
/** * Check if this subject is a child of the given parent in the subject's * current context, traversing inheritance. * * <p>This must return the same value as * {@link #isChildOf(Set, SubjectReference)} using * {@link #getActiveContexts()}.</p> * * @param parent The parent to check for inheritance * @return Whether this is a child of the given parent */ default boolean isChildOf(SubjectReference parent) { return isChildOf(getActiveContexts(), parent); }
/** * Return all parents that this group has in its current context * combination. This must include inherited values if the permissions * service supports inheritance. This must return the same value as * {@link #getParents(Set)} using {@link #getActiveContexts()}. * * @return An immutable list of parents */ default List<Subject> getParents() { return getParents(getActiveContexts()); }
/** * Test whether the subject is permitted to perform an action given as the * given permission string. This must return the same value as * {@link #hasPermission(Set, String)} using {@link #getActiveContexts()}. * * @param permission The permission string * @return True if permission is granted */ default boolean hasPermission(String permission) { return hasPermission(getActiveContexts(), permission); }
/** * Check if this subject is a child of the given parent in the subject's * current context, traversing inheritance. This must return the same value as * {@link #isChildOf(Set, Subject)} using {@link #getActiveContexts()}. * * @param parent The parent to check for inheritance * @return Whether this is a child of the given parent */ default boolean isChildOf(Subject parent) { return isChildOf(getActiveContexts(), parent); }
/** * Get the value of a given option in the subject's current context * This must return the same value as {@link #getOption(Set, String)} * using {@link #getActiveContexts()}. * * @param key The key to get an option by. Case-insensitive. * @return The value of the option, if any is present */ default Optional<String> getOption(String key) { return getOption(getActiveContexts(), key); } }