Interface GroupAgent

All Superinterfaces:
Agent
All Known Implementing Classes:
EthereumGroupAgent, GroupAgentImpl

public interface GroupAgent extends Agent
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 Details

    • addMember

      void addMember(Agent agent) throws AgentLockedException
      Adds a member to the group. Only for unlocked groups.
      Parameters:
      agent - The member to add.
      Throws:
      AgentLockedException - If this group is locked.
    • revokeMember

      void revokeMember(Agent agent) throws AgentLockedException
      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

      boolean hasMember(Agent agent)
      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

      boolean hasMember(String agentId)
      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

      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

      void addAdmin(Agent agent)
      Add an admin to the group.
      Parameters:
      agent - Member to be made admin.
    • revokeAdmin

      void revokeAdmin(Agent agent)
      Remove admin rights from member.
      Parameters:
      agent - Member to remove admin rights from.
    • isAdmin

      boolean isAdmin(Agent agent)
      Check admin rights for member.
      Parameters:
      agent - Member to check admin rights for.