- java.lang.Object
-
- org.postgresql.pljava.internal.AclId
-
public final class AclId extends Object
TheAclId
correspons to the internal PostgreSQLAclId
.- Author:
- Thomas Hallgren
-
-
Constructor Summary
Constructors Constructor Description AclId(int nativeAclId)
Called from native code.
-
Method Summary
Modifier and Type Method Description boolean
equals(Object other)
Returns equal if other is an AclId that is equal to this id.static AclId
fromName(String name)
Return the id of the named user.String
getName()
Return the name that corresponds to this id.static AclId
getOuterUser()
Return the outer database user id.static AclId
getSessionUser()
Deprecated.As of 1.5.0, this method is retained only for compatibility with old code, and returns the same value asgetOuterUser
, which should be used instead.static AclId
getUser()
Return the current effective database user id.int
hashCode()
Returns the hashCode of this id.boolean
hasSchemaCreatePermission(Oid oid)
Return true if this AclId has the right to create new objects in the given schema.int
intValue()
Returns the integer value of this id.boolean
isSuperuser()
Returns true if this AclId represents a super user.String
toString()
Returns the result of calling #getName().
-
-
-
Method Detail
-
equals
public boolean equals(Object other)
Returns equal if other is an AclId that is equal to this id.
-
intValue
public int intValue()
Returns the integer value of this id.
-
getUser
public static AclId getUser()
Return the current effective database user id.Definition: "The one to use for all normal permissions-checking purposes." Within
SECURITY DEFINER
functions and some specialized commands, it can be different from the outer ID.
-
getOuterUser
public static AclId getOuterUser()
Return the outer database user id.Definition: "the current user ID in effect at the 'outer level' (outside any transaction or function)." The session user id taking into account any
SET ROLE
in effect. This is the ID that aSECURITY DEFINER
function should revert to if it needs to operate with the invoker's permissions.- Since:
- 1.5.0
-
getSessionUser
@Deprecated public static AclId getSessionUser()
Deprecated.As of 1.5.0, this method is retained only for compatibility with old code, and returns the same value asgetOuterUser
, which should be used instead. Previously, it returned the session ID unconditionally, which is incorrect for any PostgreSQL version newer than 8.0, because it was unaware ofSET ROLE
introduced in 8.1. Any actual use case for a method that ignores roles and reports only the session ID should be reported as an issue.Deprecated synonym forgetOuterUser
.
-
fromName
public static AclId fromName(String name) throws SQLException
Return the id of the named user.- Throws:
SQLException
- if the user is unknown to the system.
-
getName
public String getName()
Return the name that corresponds to this id.
-
hasSchemaCreatePermission
public boolean hasSchemaCreatePermission(Oid oid)
Return true if this AclId has the right to create new objects in the given schema.
-
isSuperuser
public boolean isSuperuser()
Returns true if this AclId represents a super user.
-
-