Class AclId


  • public final class AclId
    extends Object
    The AclId correspons to the internal PostgreSQL AclId.
    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 as getOuterUser, 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().
    • Constructor Detail

      • AclId

        public AclId​(int nativeAclId)
        Called from native code.
    • Method Detail

      • equals

        public boolean equals​(Object other)
        Returns equal if other is an AclId that is equal to this id.
        Overrides:
        equals in class Object
      • intValue

        public int intValue()
        Returns the integer value of this id.
      • hashCode

        public int hashCode()
        Returns the hashCode of this id.
        Overrides:
        hashCode in class Object
      • 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 a SECURITY 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 as getOuterUser, 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 of SET 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 for getOuterUser.
      • 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.
      • toString

        public String toString()
        Returns the result of calling #getName().
        Overrides:
        toString in class Object