Package com.exasol.dbbuilder.dialects
Class AbstractUser
- java.lang.Object
-
- com.exasol.dbbuilder.dialects.AbstractDatabaseObject
-
- com.exasol.dbbuilder.dialects.AbstractUser
-
- All Implemented Interfaces:
DatabaseObject
,User
- Direct Known Subclasses:
ExasolUser
,MySqlUser
,PostgreSqlUser
public abstract class AbstractUser extends AbstractDatabaseObject implements User
This class contains common logic for a database user.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<GlobalPrivilege>
globalPrivileges
protected Map<DatabaseObject,ObjectPrivilege[]>
objectPrivileges
protected String
password
-
Fields inherited from class com.exasol.dbbuilder.dialects.AbstractDatabaseObject
name, owned
-
-
Constructor Summary
Constructors Constructor Description AbstractUser(com.exasol.db.Identifier name)
Create a new database user with a default password.AbstractUser(com.exasol.db.Identifier name, String password)
Create a new database user.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
drop()
Drop the database object and all contained objects.Set<GlobalPrivilege>
getGlobalPrivileges()
Get the systemPrivileges of the user.Map<DatabaseObject,ObjectPrivilege[]>
getObjectPrivileges()
Get the objectPrivileges of the user.String
getPassword()
Get the user's password.protected abstract DatabaseObjectWriter
getWriter()
Get aDatabaseObjectWriter
.User
grant(DatabaseObject object, ObjectPrivilege... privileges)
Grant the user access to a database schema with the given privileges.User
grant(GlobalPrivilege... privileges)
Grant system privileges to a user.-
Methods inherited from class com.exasol.dbbuilder.dialects.AbstractDatabaseObject
getFullyQualifiedName, getName, isOwned
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exasol.dbbuilder.dialects.DatabaseObject
getFullyQualifiedName, getName, isOwned
-
Methods inherited from interface com.exasol.dbbuilder.dialects.User
getParent, getType, grantAllAccess, hasParent
-
-
-
-
Field Detail
-
password
protected final String password
-
objectPrivileges
protected final Map<DatabaseObject,ObjectPrivilege[]> objectPrivileges
-
globalPrivileges
protected final Set<GlobalPrivilege> globalPrivileges
-
-
Constructor Detail
-
AbstractUser
public AbstractUser(com.exasol.db.Identifier name)
Create a new database user with a default password.This method creates a user with a password derived from the user name. Note that this is only acceptable in the scope of testing for which the TDDB is made. Never use something like this in production code!
- Parameters:
name
- user name
-
AbstractUser
public AbstractUser(com.exasol.db.Identifier name, String password)
Create a new database user.- Parameters:
name
- user namepassword
- login password
-
-
Method Detail
-
getPassword
public String getPassword()
Description copied from interface:User
Get the user's password.- Specified by:
getPassword
in interfaceUser
- Returns:
- password
-
getObjectPrivileges
public Map<DatabaseObject,ObjectPrivilege[]> getObjectPrivileges()
Description copied from interface:User
Get the objectPrivileges of the user.- Specified by:
getObjectPrivileges
in interfaceUser
- Returns:
- object privileges
-
getGlobalPrivileges
public Set<GlobalPrivilege> getGlobalPrivileges()
Description copied from interface:User
Get the systemPrivileges of the user.- Specified by:
getGlobalPrivileges
in interfaceUser
- Returns:
- system privileges
-
getWriter
protected abstract DatabaseObjectWriter getWriter()
Get aDatabaseObjectWriter
.- Returns:
DatabaseObjectWriter
-
grant
public User grant(DatabaseObject object, ObjectPrivilege... privileges)
Description copied from interface:User
Grant the user access to a database schema with the given privileges.
-
grant
public User grant(GlobalPrivilege... privileges)
Description copied from interface:User
Grant system privileges to a user.
-
drop
public void drop()
Description copied from interface:DatabaseObject
Drop the database object and all contained objects.- Specified by:
drop
in interfaceDatabaseObject
-
-