%SQL.Manager.CatalogPriv
hidden class %SQL.Manager.CatalogPriv
SQL Catalog Queries - PrivilegedMethod Inventory
- RolePrivilegesClose()
- RolePrivilegesExecute()
- RolePrivilegesFetch()
- RoleUserClose()
- RoleUserExecute()
- RoleUserFetch()
- RolesClose()
- RolesExecute()
- RolesFetch()
- UserColumnPrivsClose()
- UserColumnPrivsExecute()
- UserColumnPrivsFetch()
- UserEscalationRoleClose()
- UserEscalationRoleExecute()
- UserEscalationRoleFetch()
- UserExistsClose()
- UserExistsExecute()
- UserExistsFetch()
- UserPrivsClose()
- UserPrivsExecute()
- UserPrivsFetch()
- UserRoleClose()
- UserRoleExecute()
- UserRoleFetch()
- UserRoleInfoClose()
- UserRoleInfoExecute()
- UserRoleInfoFetch()
- UserSysPrivsClose()
- UserSysPrivsExecute()
- UserSysPrivsFetch()
- UsersClose()
- UsersExecute()
- UsersFetch()
- WhoAmIClose()
- WhoAmIExecute()
- WhoAmIFetch()
Methods
classmethod RolePrivilegesClose(%q As %Library.Binary) as %Status
classmethod RolePrivilegesExecute(ByRef %q As %Library.Binary, role As %Library.String = "") as %Library.Status
classmethod RolePrivilegesFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod RoleUserClose(%q As %Library.Binary) as %Status
classmethod RoleUserExecute(ByRef %q As %Library.Binary, role As %Library.String) as %Library.Status
classmethod RoleUserFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod RolesClose(%q As %Library.Binary) as %Library.Status
classmethod RolesExecute(ByRef %q As %Library.Binary) as %Library.Status
classmethod RolesFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserColumnPrivsClose(%q As %Library.Binary) as %Status
classmethod UserColumnPrivsExecute(ByRef %q As %Library.Binary, user As %Library.String = "", schema As %Library.String = "", table As %Library.String = "", system As %Library.Boolean = 0) as %Library.Status
classmethod UserColumnPrivsFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserEscalationRoleClose(%q As %Library.Binary) as %Status
classmethod UserEscalationRoleExecute(ByRef %q As %Library.Binary, user As %String = "") as %Status
classmethod UserEscalationRoleFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserExistsClose(%q As %Library.Binary) as %Library.Status
classmethod UserExistsExecute(ByRef %q As %Library.Binary, user As %String = "") as %Status
classmethod UserExistsFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserPrivsClose(%q As %Library.Binary) as %Status
classmethod UserPrivsExecute(ByRef %q As %Library.Binary, user As %Library.String = "", system As %Library.Boolean = 0) as %Library.Status
classmethod UserPrivsFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserRoleClose(%q As %Library.Binary) as %Status
classmethod UserRoleExecute(ByRef %q As %Library.Binary, user As %String = "") as %Status
classmethod UserRoleFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserRoleInfoClose(%q As %Library.Binary) as %Library.Status
classmethod UserRoleInfoExecute(ByRef %q As %Library.Binary, user As %Library.String = "") as %Library.Status
classmethod UserRoleInfoFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UserSysPrivsClose(ByRef %q As %Library.Binary) as %Library.Status
classmethod UserSysPrivsExecute(ByRef %q As %Library.Binary, user As %Library.String = "") as %Library.Status
classmethod UserSysPrivsFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod UsersClose(%q As %Library.Binary) as %Status
classmethod UsersExecute(ByRef %q As %Library.Binary) as %Library.Status
classmethod UsersFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
classmethod WhoAmIClose(%q As %Library.Binary) as %Library.Status
classmethod WhoAmIExecute(ByRef %q As %Library.Binary) as %Library.Status
classmethod WhoAmIFetch(ByRef %q As %Library.Binary, ByRef Row As %Library.List, AtEnd As %Library.Integer) as %Library.Status
Queries
query RolePrivileges(role As %Library.String)
Selects TYPE As %Library.String, NAME As %Library.String, PRIVILEGE As %Library.String, GRANTED_BY As %Library.String, GRANT_OPTION As %Library.String
Get a list of Privileges granted to a Role
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.RolePrivleges Procedure
	%SQL.Manager.CatalogPriv.RolePrivileges('rolename')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of a Role.
		Returns all privileges granted to the role.
		ROWSPEC = TYPE:%Library.String			- TABLE or VIEW or STORED PROCEDURE
			  NAME:%Library.String 			- Name of the table, view, or procedure with privs granted to the role
			  PRIVILEGE:%Library.String 		- Privilege granted
			  GRANTED_BY:%Library.String		- SQL user name who granted the privilege
			  GRANT_OPTION:%Library.String		- 'Yes' or 'No', privilege granted with grant option
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query RoleUser(role As %Library.String)
Get a list of all Users granted a Role.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.RoleUser Procedure
	%SQL.Manager.CatalogPriv.RoleUser('rolename')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of a Role.
		Returns all SQL Users granted the role
		ROWSPEC = NAME:%Library.String	- Name of the SQL user granted the role
                      USER:%Library.String  - ROLE or USER, type of UID it is granted too
                      ADMIN_OPTION:%Library.Boolean - 1/0 Role granted with Admin Option?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query Roles()
Selects ROLE_NAME As %Library.String, DESCRIPTION As %Library.String, CREATED_BY As %Library.String, ESCALATION_ONLY As %Library.Boolean
Get a list of all SQL Roles.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.Roles Procedure
	%SQL.Manager.CatalogPriv.Roles()
		Takes no parameters
		Returns all SQL Roles defined
		ROWSPEC = ROLE_NAME:%Library.String	- Name of the role
			  DESCRIPTION:%Library.String	- Role's Desription
			  CREATED_BY:%Library.String	- SQL User who created the Role
			  ESCALATION_ONLY:%Library.Boolean - Can this role be assigned at login, or can it only be used for escalation?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query UserColumnPrivs(user As %Library.String, schema As %Library.String = "", table As %Library.String = "", system As %Library.Boolean = 0)
Selects COLUMN_NAME As %Library.String, PRIVILEGE As %Library.String(MAXLEN=10), GRANTED_BY As %Library.String, GRANT_OPTION As %Library.String(MAXLEN=3), GRANTED_VIA As %Library.String
Get a list of Privileges granted to a SQL User on a table or view's columns
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  SQL_MANAGER.UserColumnPrivs Procedure
	%SQL.Manager.CatalogPriv.UserColumnPrivs('username','schema','tablename','system')
		Takes arguments:
			username  -  %Library.String/VARCHAR type parameter which is the name of a SQL User or Role.
			schema    -  %Library.String/VARCHAR type parameter which is the name of schema the table or view is in.
			tablename -  %Library.String/VARCHAR type parameter which is the name of table or view.
			system    -  %Boolean type parameter which defaults to 0, 1 if you want to get column privileges on a system class.
		Returns all privileges granted to the user for a single table's columns
		ROWSPEC = COLUMN_NAME:%Library.String 	- Column Name with privs granted to the user
			  PRIVILEGE:%Library.String 	- Privilege granted
			  GRANTED_BY:%Library.String	- SQL user name who granted the privilege
			  GRANT_OPTION:%Library.String	- 'Yes' or 'No', privilege granted with grant option
			  GRANTED_VIA:%Library.String   - Direct, SuperUser, Role, _PUBLIC - How was the user granted the priv
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query UserEscalationRole(user As %Library.String)
Selects ROLE_NAME As %Library.String
Get a list of all System Roles available to an SQL User.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_Manager.UserEscalationRole Procedure
	%SQL.Manager.CatalogPriv.UserEscalationRole('username')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of a SQL user.
		Returns all EscalationRoles available to the user
		ROWSPEC = ROLE_NAME:%Library.String	- Name of the system role available to the user
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query UserExists(user As %Library.String)
Selects USER_NAME As %Library.String
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.UserExists Procedure
	%SQL.Manager.CatalogPriv.UserExists('username')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of an SQL user.
		Returns the SQL username if the user exists, otherwise nothing:
		ROWSPEC = USER_NAME:%Library.String	- Name of the SQL user
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If the user exists, return the username; otherwise nothing
query UserPrivs(user As %Library.String, system As %Library.Boolean = 0)
Selects TYPE As %Library.String, NAME As %Library.String, PRIVILEGE As %Library.String(MAXLEN=10), GRANTED_BY As %Library.String, GRANT_OPTION As %Library.String(MAXLEN=3), GRANTED_VIA As %Library.String, HAS_COLUMN_PRIV As %Library.Boolean
Get a list of Privileges granted to a SQL User
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  SQL_MANAGER.UserPrivs Procedure
	%SQL.Manager.CatalogPriv.UserPrivs('username')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of a SQL User.
		Returns all privileges granted to the user.
		ROWSPEC = TYPE:%Library.String		    - TABLE, VIEW, STORED PROCEDURE
			  NAME:%Library.String 		        - Name of the item with privs granted to the user
			  PRIVILEGE:%Library.String 	    - Privilege granted
			  GRANTED_BY:%Library.String	    - SQL user name who granted the privilege
			  GRANT_OPTION:%Library.String	    - 'Yes' or 'No', privilege granted with grant option
			  GRANTED_VIA:%Library.String       - Direct, SuperUser, Role, _PUBLIC - How was the user granted the priv
              HAS_COLUMN_PRIV:%Library.Boolean  - 1 if this table or view has any privileges defined at the column level
											      otherwise 0.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query UserRole(user As %Library.String)
Selects ROLE_NAME As %Library.String, ADMIN_OPTION As %Library.Boolean
Get a list of all Roles granted to an SQL User.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_Manager.UserRole Procedure
	%SQL.Manager.CatalogPriv.UserRole('username')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of a SQL user.
		Returns all Roles granted to the user
		ROWSPEC = ROLE_NAME:%Library.String	- Name of the role granted to the user
                      ADMIN_OPTION:%Library.Boolean - 1/0 Role granted with Admin Option?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query UserRoleInfo(user As %Library.String)
Selects NAME As %Library.String, TYPE As %Library.String(MAXLEN=4)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.UserRoleInfo Procedure
	%SQL.Manager.CatalogPriv.UserRoleInfo('userrole')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of an SQL user or SQL Role.
		Returns the name of the user/role if the user/role exists, otherwise nothing:
		ROWSPEC = NAME:%Library.String - Name of the User/Role
                      TYPE:%Library.String - Type of the name "USER" or "ROLE"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If the user/role exists, return the user/role's information; otherwise nothing
query UserSysPrivs(user As %Library.String)
Selects PRIVILEGE As %Library.String, ADMIN_OPTION As %Library.String, GRANTED_VIA As %Library.String
Get all System Privileges granted to the user/role 'user'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.UserSysPriv Procedure
	%SQL.Manager.CatalogPriv.UserSysPrivs('username')
		Takes 1 %Library.String/VARCHAR type parameter which is the name of an SQL User or Role.
		Returns all system privileges granted to a user or role
		ROWSPEC = PRIVILEGE:%Library.String	- Name of the system privilege granted
			  ADMIN_OPTION:%Library.String - 'Yes' or 'No' whether the privilege was granted with admin option
			  GRANTED_VIA:%Library.String   - Direct, SuperUser, Role, _PUBLIC - How was the user granted the priv
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query Users()
Selects USERNAME As %Library.String, FULLNAME As %Library.String, ENABLED As %Library.String, NAMESPACE As %Library.String, ROUTINE As %Library.String, TYPE As %Library.String
Get a list of all SQL Users.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.Users Procedure
	%SQL.Manager.CatalogPriv.Users()
		Takes no parameters
		Returns a list of SQL users:
		ROWSPEC = USERNAME:%Library.String    - Name of the SQL user
		          DESCRIPTION:%Library.String - SQL User description
                      ENABLED:%Library.String     - Yes/No: is user definition enabled?
                      NAMESPACE:%Library.String   - User's Namespace
                      ROUTINE:%Library.String     - Routine
                      TYPE:%Library.String        - Type of User - InterSystems IRIS, LDAP, etc.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
query WhoAmI()
Selects $USERNAME As %Library.String, $ROLES As %Library.String
Who Am I
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  %SQL_MANAGER.WhoAmI Procedure
	%SQL.Manager.CatalogPriv.WhoAmI()
		Takes no parameters
		Returns all SQL Roles defined
		ROWSPEC = $USERNAME:%Library.String	- Name of the Current User
			  $ROLES:%Library.String	- User's current $Roles value
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-