Package io.openems.edge.common.user
Class User
- java.lang.Object
-
- io.openems.common.session.AbstractUser
-
- io.openems.edge.common.user.User
-
- Direct Known Subclasses:
DummyUser
,ManagedUser
public class User extends AbstractUser
AUser
used by OpenEMS Edge.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_EDGE_ID
Default-Edge-ID for User.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertRoleIsAtLeast(java.lang.String resource, Role role)
Throws an exception if the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
) is equal or more privileged than the given Role.static User
from(com.google.gson.JsonObject j)
Parses aJsonObject
to a User.Role
getRole()
Gets the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
).java.lang.String
toString()
-
Methods inherited from class io.openems.common.session.AbstractUser
getEdgeRoles, getGlobalRole, getId, getLanguage, getName, getRole, setLanguage, setRole
-
-
-
-
Field Detail
-
DEFAULT_EDGE_ID
public static final java.lang.String DEFAULT_EDGE_ID
Default-Edge-ID for User.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRole
public Role getRole()
Gets the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
).- Returns:
- the
Role
-
assertRoleIsAtLeast
public void assertRoleIsAtLeast(java.lang.String resource, Role role) throws OpenemsError.OpenemsNamedException
Throws an exception if the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
) is equal or more privileged than the given Role.- Parameters:
resource
- a resource identifier; used for the exceptionrole
- the comparedRole
- Throws:
OpenemsError.OpenemsNamedException
- if the global Role privileges are less
-
from
public static User from(com.google.gson.JsonObject j) throws OpenemsError.OpenemsNamedException
Parses aJsonObject
to a User.{ "id": string, "name: string, "language"?: string, "role": string }
- Parameters:
j
- theJsonObject
- Returns:
- a
User
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-