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
A
User
used by OpenEMS Edge.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertRoleIsAtLeast
(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.getRole()
Gets the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
).boolean
Gets the Number of Devices, that the user is allowed to see.toString()
Methods inherited from class io.openems.common.session.AbstractUser
getEdgeRoles, getGlobalRole, getId, getLanguage, getName, getRole, getSettings, setLanguage, setRole
-
Field Details
-
DEFAULT_EDGE_ID
Default-Edge-ID for User.- See Also:
-
-
Constructor Details
-
User
Constructs anUser
.- Parameters:
id
- the User-IDname
- the namelanguage
- theLanguage
role
- theRole
; used as global Role and assigned toDEFAULT_EDGE_ID
.
-
-
Method Details
-
getRole
Gets the Role (Global and Per-Edge-Role are the same for OpenEMS EdgeUser
).- 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 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
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
-
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 classAbstractUser
- Returns:
- the numberOfDevices
-