Class User

    • Constructor Detail

      • User

        public User​(java.lang.String id,
                    java.lang.String name,
                    java.lang.String token,
                    Role globalRole,
                    java.util.NavigableMap<java.lang.String,​Role> roles,
                    java.lang.String language)
    • Method Detail

      • getToken

        public java.lang.String getToken()
        Gets the login token.
        Returns:
        the token
      • getLanguage

        public java.lang.String getLanguage()
        Gets the user language.
        Returns:
        the language
      • roleIsAtLeast

        public boolean roleIsAtLeast​(java.lang.String edgeId,
                                     Role role)
        Gets the information whether the Users Role for the given Edge is equal or more privileged than the given Role.
        Parameters:
        edgeId - the Edge-Id
        role - the compared Role
        Returns:
        true if the Users Role privileges are equal or higher
      • assertEdgeRoleIsAtLeast

        public Role assertEdgeRoleIsAtLeast​(java.lang.String resource,
                                            java.lang.String edgeId,
                                            Role role)
                                     throws OpenemsError.OpenemsNamedException
        Throws an exception if the current Role is equal or more privileged than the given Role.
        Parameters:
        resource - a resource identifier; used for the exception
        edgeId - the Edge-ID
        role - the compared Role
        Returns:
        the current Role
        Throws:
        OpenemsError.OpenemsNamedException - if the current Role privileges are less