Class User

java.lang.Object
org.basex.core.users.User

public final class User extends Object
This class contains information on a single user.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • User

      public User(String name, String password)
      Constructor.
      Parameters:
      name - user name
      password - password
  • Method Details

    • toXML

      public FElem toXML(QueryContext qc)
      Returns user information as XML.
      Parameters:
      qc - query context (null if element will only be created for serialization)
      Returns:
      user element
    • name

      public void name(String nm)
      Sets the user name.
      Parameters:
      nm - name
    • drop

      public void drop(String pattern)
      Drops the specified database pattern.
      Parameters:
      pattern - database pattern
    • name

      public String name()
      Returns the user name.
      Returns:
      name
    • password

      public void password(String password)
      Computes new password hashes.
      Parameters:
      password - password (plain text)
    • code

      public String code(Algorithm alg, Code code)
      Returns the specified code.
      Parameters:
      alg - used algorithm
      code - code to be returned
      Returns:
      code, or null if code does not exist
    • perm

      public Perm perm(String db)
      Returns the global permission, or the permission for the specified database.
      Parameters:
      db - database pattern (can be null)
      Returns:
      permission
    • perm

      public User perm(Perm prm)
      Sets the global permission.
      Parameters:
      prm - permission
      Returns:
      self reference
    • perm

      public User perm(Perm prm, String pattern)
      Sets the permission.
      Parameters:
      prm - permission
      pattern - database pattern (can be empty)
      Returns:
      self reference
    • has

      public boolean has(Perm prm)
      Tests if the user has the specified permission.
      Parameters:
      prm - permission to be checked
      Returns:
      result of check
    • has

      public boolean has(Perm prm, String db)
      Tests if the user has the specified permission.
      Parameters:
      prm - permission to be checked
      db - database pattern (can be null)
      Returns:
      result of check
    • matches

      public boolean matches(String password)
      Computes the hash from the specified password and checks if it is correct.
      Parameters:
      password - (plain text)
      Returns:
      name
    • info

      public ANode info()
      Returns the info element.
      Returns:
      info element (can be null)
    • info

      public void info(ANode elem)
      Sets the info element.
      Parameters:
      elem - info element