Package i5.las2peer.api.security
Interface GroupAgent
- All Superinterfaces:
Agent
- All Known Implementing Classes:
EthereumGroupAgent
,GroupAgentImpl
Represents a group of agents that is an agent itself.
Note that changes are only applied when the agent is stored.
A GroupAgent has two states: a locked state and an unlocked state. Only unlocked agents can be altered and stored.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an admin to the group.void
Adds a member to the group.Getter for the group name.String[]
Get a list of direct group members.int
getSize()
Get the number of direct group members.boolean
Check if the agent has a group name set.boolean
Checks if the given agent is a member of this group.boolean
Checks if the given agent is a member of this group.boolean
Check admin rights for member.void
revokeAdmin
(Agent agent) Remove admin rights from member.void
revokeMember
(Agent agent) Revokes a group membership.void
Unlock this group using a given agent.Methods inherited from interface i5.las2peer.api.security.Agent
getIdentifier, isLocked
-
Method Details
-
addMember
Adds a member to the group. Only for unlocked groups.- Parameters:
agent
- The member to add.- Throws:
AgentLockedException
- If this group is locked.
-
revokeMember
Revokes a group membership. This means that the given agent will not have access to any future updates to agents and contents this group has access to throgh this group. However, existing content may still be available to the revoked member. Ideally, a new key pair for this group will be generated whenever a member is removed. Only for unlocked groups.- Parameters:
agent
- The member to remove from the group.- Throws:
AgentLockedException
- If this group is locked.
-
hasMember
Checks if the given agent is a member of this group.- Parameters:
agent
- The agent whose membership has to be checked.- Returns:
- true if the given agent is a member of this group.
-
hasMember
Checks if the given agent is a member of this group.- Parameters:
agentId
- The id of the agent whose membership has to be checked.- Returns:
- true if the given agent is a member of this group.
-
unlock
void unlock(Agent agent) throws AgentAccessDeniedException, AgentOperationFailedException, AgentLockedException Unlock this group using a given agent. Will not work for transitive memberships.- Parameters:
agent
- A direct member of this group, must be unlocked.- Throws:
AgentAccessDeniedException
- If the given agent is not a direct member of this group.AgentOperationFailedException
- If the agent's private key can not be deserialized.AgentLockedException
- If agent is locked.
-
getSize
int getSize()Get the number of direct group members.- Returns:
- The group size.
-
getMemberList
String[] getMemberList()Get a list of direct group members.- Returns:
- A list of ids of group members.
-
getGroupName
String getGroupName()Getter for the group name.- Returns:
- The group name.
-
hasGroupName
boolean hasGroupName()Check if the agent has a group name set.- Returns:
- true If a group name is set up.
-
addAdmin
Add an admin to the group.- Parameters:
agent
- Member to be made admin.
-
revokeAdmin
Remove admin rights from member.- Parameters:
agent
- Member to remove admin rights from.
-
isAdmin
Check admin rights for member.- Parameters:
agent
- Member to check admin rights for.
-