/** * <p> Grants the given {@link Role} to the provided {@link IdentityType}. </p> * * @param assignee A previously loaded {@link IdentityType} instance. Valid instances are only from the {@link Account} and {@link Group} types. * @param role A previously loaded {@link Role} instance. * * @throws IdentityManagementException If the method fails. */ public static void grantRole(RelationshipManager relationshipManager, IdentityType assignee, Role role) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (assignee == null) { throw MESSAGES.nullArgument("IdentityType"); } if (!Account.class.isInstance(assignee) && !Group.class.isInstance(assignee)) { throw MESSAGES.unexpectedType(assignee.getClass()); } if (role == null) { throw MESSAGES.nullArgument("Role"); } relationshipManager.add(new Grant(assignee, role)); }
/** * <p> Grants the given {@link Role} to the provided {@link IdentityType}. </p> * * @param assignee A previously loaded {@link IdentityType} instance. Valid instances are only from the {@link Account} and {@link Group} types. * @param role A previously loaded {@link Role} instance. * * @throws IdentityManagementException If the method fails. */ public static void grantRole(RelationshipManager relationshipManager, IdentityType assignee, Role role) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (assignee == null) { throw MESSAGES.nullArgument("IdentityType"); } if (!Account.class.isInstance(assignee) && !Group.class.isInstance(assignee)) { throw MESSAGES.unexpectedType(assignee.getClass()); } if (role == null) { throw MESSAGES.nullArgument("Role"); } relationshipManager.add(new Grant(assignee, role)); }
/** * <p> Adds the given {@link Account} as a member of the provided {@link Group}. </p> * * @param member A previously loaded {@link Account} instance. * @param group A previously loaded {@link Group} instance. * * @throws IdentityManagementException If the method fails. */ public static void addToGroup(RelationshipManager relationshipManager, Account member, Group group) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (member == null) { throw MESSAGES.nullArgument("Account"); } if (group == null) { throw MESSAGES.nullArgument("Group"); } relationshipManager.add(new GroupMembership(member, group)); }
/** * <p> Adds the given {@link Account} as a member of the provided {@link Group}. </p> * * @param member A previously loaded {@link Account} instance. * @param group A previously loaded {@link Group} instance. * * @throws IdentityManagementException If the method fails. */ public static void addToGroup(RelationshipManager relationshipManager, Account member, Group group) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (member == null) { throw MESSAGES.nullArgument("Account"); } if (group == null) { throw MESSAGES.nullArgument("Group"); } relationshipManager.add(new GroupMembership(member, group)); }
/** * <p> Creates a {@link GroupRole} relationship for the given {@link IdentityType}, {@link Role} and {@link Group} * instances. </p> * * @param assignee A previously loaded {@link IdentityType} instance. * @param role A previously loaded {@link Role} instance. * @param group A previously loaded {@link Group} instance. * * @throws IdentityManagementException If the method fails. */ public static void grantGroupRole(RelationshipManager relationshipManager, IdentityType assignee, Role role, Group group) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (assignee == null) { throw MESSAGES.nullArgument("IdentityType"); } if (role == null) { throw MESSAGES.nullArgument("Role"); } if (group == null) { throw MESSAGES.nullArgument("Group"); } relationshipManager.add(new GroupRole(assignee, group, role)); }
/** * <p> Creates a {@link GroupRole} relationship for the given {@link IdentityType}, {@link Role} and {@link Group} * instances. </p> * * @param assignee A previously loaded {@link IdentityType} instance. * @param role A previously loaded {@link Role} instance. * @param group A previously loaded {@link Group} instance. * * @throws IdentityManagementException If the method fails. */ public static void grantGroupRole(RelationshipManager relationshipManager, IdentityType assignee, Role role, Group group) throws IdentityManagementException { if (relationshipManager == null) { throw MESSAGES.nullArgument("RelationshipManager"); } if (assignee == null) { throw MESSAGES.nullArgument("IdentityType"); } if (role == null) { throw MESSAGES.nullArgument("Role"); } if (group == null) { throw MESSAGES.nullArgument("Group"); } relationshipManager.add(new GroupRole(assignee, group, role)); }