Thursday, December 18, 2014

Tip of the Day: Undocumented TINFO Function
Product.: R:BASE eXtreme 9.5 (32/64)
Build...: 9.5.4.31125 or higher www.rcornucopia.com www.rupdates.com
Section.: R:BASE Functions
Keywords: Functions, User Privileges

There is an undocumented TINFO function in R:BASE which returns access right information for the
current user.

(TINFO(arg1,arg2,arg3))

Where:  

  arg1 is zero (0), which specifies to show table permissions
arg2 is the system table ID (SYS_TABLE_ID) value (can be located in the SYS_TABLES system table)
  arg3 can be:
     a) A specific system column ID (SYS_COLUMN_ID) in that table
b) A value of 0 which means show permissions that apply to all the columns in that table c) A value of -1 which means show permissions that apply to any of the columns in that table

Remarks:

 . TINFO returns a comma delimited string of the access rights.
. In most instances table and column privileges are identical. Cases where they are not are autonumber column (no INSERT), computed columns, (no INSERT or UPDATE), and where the UPDATE
   privilege was granted to specific columns only.
 . Permissions are returned based upon the current USER.

Examples:

The following example is based upon a database configured with an OWNER and users, where limited
permissions are supplied to a user Jim for the Component table.

While connected to the database as the OWNER, the system table ID and system column ID can be
found for the Component table and CompDesc column.

SELECT SYS_TABLE_ID FROM SYS_TABLES WHERE SYS_TABLE_NAME = 'Component'
 SYS_TABLE_ID
 ------------
           29

R>SELECT SYS_COLUMN_ID FROM SYS_COLUMNS WHERE SYS_COLUMN_NAME = 'CompDesc'
 SYS_COLUMN_ID
 -------------
           188

R>SET USER JIM JIM999

Example 01:

-- Permissions specifically for the column CompDesc
R>SET VAR vUserInfoColumn = (TINFO(0,29,188))
R>SHOW VAR vUserInfoColumn
SELECT, UPDATE

Example 02:

-- Permissions for all columns.
-- Only SELECT is returned since that is the only permission applied to all columns.
R>SET VAR vUserInfoAllColumns = (TINFO(0,29,0))
R>SHOW VAR vUserInfoAllColumns

SELECT

Example 03:

-- Permissions for any column.
-- Both SELECT and UPDATE are returned since there are some columns with both of those permissions.
R>SET VAR vUserInfoAnyColumn = (TINFO(0,29,-1))
R>SHOW VAR vUserInfoAnyColumn
SELECT, UPDATE

Very Best R:egards,

Razzak.

www.rbase.com
www.facebook.com/rbase
--
31 years of continuous innovation!
16 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
--

--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, place any text to search for.
================================================


Reply via email to