public class BasicModel extends Object
This class provides a number of static convenience methods for looking up identities from the basic identity model.
Constructor and Description |
---|
BasicModel() |
Modifier and Type | Method and Description |
---|---|
static void |
addToGroup(RelationshipManager relationshipManager,
Account member,
Group group)
|
static Agent |
getAgent(IdentityManager identityManager,
String loginName)
Returns an
Agent instance with the given loginName . |
static Group |
getGroup(IdentityManager identityManager,
String groupPath)
Returns a
Group instance with the specified groupPath . |
static Group |
getGroup(IdentityManager identityManager,
String groupName,
Group parent)
|
static Role |
getRole(IdentityManager identityManager,
String name)
Returns an
Role instance with the given name . |
static User |
getUser(IdentityManager identityManager,
String loginName)
Returns an
User instance with the given loginName . |
static void |
grantGroupRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role,
Group group)
|
static void |
grantRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role)
Grants the given
Role to the provided IdentityType . |
static boolean |
hasGroupRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role,
Group group)
|
static boolean |
hasRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role)
Checks if the given
Role is granted to the provided IdentityType . |
static boolean |
isMember(RelationshipManager relationshipManager,
Account member,
Group group)
Checks if the given
IdentityType is a member of a specific Group . |
static void |
removeFromGroup(RelationshipManager relationshipManager,
Account member,
Group group)
|
static void |
revokeGroupRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role,
Group group)
|
static void |
revokeRole(RelationshipManager relationshipManager,
IdentityType assignee,
Role role)
Revokes the given
Role from the provided IdentityType . |
public static Agent getAgent(IdentityManager identityManager, String loginName) throws IdentityManagementException
Returns an Agent
instance with the given loginName
.
loginName
- The agent's login name.Agent
instance or null if the loginName
is null or an empty string. User
are also agents, so if the loginName
maps to an user, it will be returned.IdentityManagementException
- If the method fails.public static User getUser(IdentityManager identityManager, String loginName) throws IdentityManagementException
Returns an User
instance with the given loginName
.
loginName
- The agent's login name.User
instance or null if the loginName
is null or an empty string.IdentityManagementException
- If the method fails.public static Role getRole(IdentityManager identityManager, String name) throws IdentityManagementException
Returns an Role
instance with the given name
.
name
- The role's name.Role
instance or null if the name
is null or an empty string.IdentityManagementException
- If the method fails.public static Group getGroup(IdentityManager identityManager, String groupPath) throws IdentityManagementException
Returns a Group
instance with the specified groupPath
. Eg.: /groupA/groupB/groupC.
groupPath
- The group's path or its name without the group separator. In this last case, the returned group
will be the root group. Eg.: Administrators == /Administrators.Group
instance or null if the groupPath
is null or an empty string.IdentityManagementException
- If the method fails.public static Group getGroup(IdentityManager identityManager, String groupName, Group parent) throws IdentityManagementException
groupName
- The group's name.parent
- A Group
instance with a valid identifier or null. In this last case, the returned group
will be always a root group.Group
instance or null if the groupName
is null or an empty string.IdentityManagementException
- If the method fails.public static boolean isMember(RelationshipManager relationshipManager, Account member, Group group) throws IdentityManagementException
Checks if the given IdentityType
is a member of a specific Group
.
member
- A previously loaded Account
instance.group
- A previously loaded Group
instance.Account
is a member of the provided Group
. Otherwise this method returns
false.IdentityManagementException
- If the method fails.public static void addToGroup(RelationshipManager relationshipManager, Account member, Group group) throws IdentityManagementException
member
- A previously loaded Account
instance.group
- A previously loaded Group
instance.IdentityManagementException
- If the method fails.public static void removeFromGroup(RelationshipManager relationshipManager, Account member, Group group) throws IdentityManagementException
member
- A previously loaded Account
instance.group
- A previously loaded Group
instance.IdentityManagementException
- If the method fails.public static boolean hasGroupRole(RelationshipManager relationshipManager, IdentityType assignee, Role role, Group group) throws IdentityManagementException
Checks if the given IdentityType
, Role
and Group
instances maps to a GroupRole
relationship.
assignee
- A previously loaded IdentityType
instance.role
- A previously loaded Role
instance.group
- A previously loaded Group
instance.assignee
, role
and group
map to a previously stored
GroupRole
relationship. Otherwise this method returns false.IdentityManagementException
- If the method fails.public static void grantGroupRole(RelationshipManager relationshipManager, IdentityType assignee, Role role, Group group) throws IdentityManagementException
Creates a GroupRole
relationship for the given IdentityType
, Role
and Group
instances.
assignee
- A previously loaded IdentityType
instance.role
- A previously loaded Role
instance.group
- A previously loaded Group
instance.IdentityManagementException
- If the method fails.public static void revokeGroupRole(RelationshipManager relationshipManager, IdentityType assignee, Role role, Group group) throws IdentityManagementException
Revokes a GroupRole
relationship for the given IdentityType
, Role
and Group
instances.
assignee
- A previously loaded IdentityType
instance.role
- A previously loaded Role
instance.group
- A previously loaded Group
instance.IdentityManagementException
- If the method fails.public static boolean hasRole(RelationshipManager relationshipManager, IdentityType assignee, Role role) throws IdentityManagementException
Checks if the given Role
is granted to the provided IdentityType
.
assignee
- A previously loaded IdentityType
instance. Valid instances are only from the Account
and Group
types.role
- A previously loaded Role
instance.Role
is granted. Otherwise this method returns false.IdentityManagementException
- If the method fails.public static void grantRole(RelationshipManager relationshipManager, IdentityType assignee, Role role) throws IdentityManagementException
Grants the given Role
to the provided IdentityType
.
assignee
- A previously loaded IdentityType
instance. Valid instances are only from the Account
and Group
types.role
- A previously loaded Role
instance.IdentityManagementException
- If the method fails.public static void revokeRole(RelationshipManager relationshipManager, IdentityType assignee, Role role) throws IdentityManagementException
Revokes the given Role
from the provided IdentityType
.
assignee
- A previously loaded IdentityType
instance. Valid instances are only from the Account
and Group
types.role
- A previously loaded Role
instance.IdentityManagementException
- If the method fails.Copyright © 2018 JBoss by Red Hat. All rights reserved.