Class User

Direct Known Subclasses:
DummyUser, ManagedUser

public class User extends AbstractUser
A User used by OpenEMS Edge.
  • Field Details

  • Constructor Details

  • Method Details

    • getRole

      public Role getRole()
      Gets the Role (Global and Per-Edge-Role are the same for OpenEMS Edge User).
      Returns:
      the Role
    • assertRoleIsAtLeast

      public void assertRoleIsAtLeast(String resource, Role role) throws OpenemsError.OpenemsNamedException
      Throws an exception if the Role (Global and Per-Edge-Role are the same for OpenEMS Edge User) is equal or more privileged than the given Role.
      Parameters:
      resource - a resource identifier; used for the exception
      role - the compared Role
      Throws:
      OpenemsError.OpenemsNamedException - if the global Role privileges are less
    • from

      public static User from(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException
      Parses a JsonObject to a User.
       {
         "id": string,
         "name: string,
         "language"?: string,
         "role": string
       }
       
      Parameters:
      j - the JsonObject
      Returns:
      a User
      Throws:
      OpenemsError.OpenemsNamedException - on error
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasMultipleEdges

      public boolean hasMultipleEdges()
      Description copied from class: AbstractUser
      Gets the Number of Devices, that the user is allowed to see.
      Specified by:
      hasMultipleEdges in class AbstractUser
      Returns:
      the numberOfDevices