cancel
Showing results for 
Search instead for 
Did you mean: 

Curious SP

jmtorres
Active Participant
0 Kudos

Hello,

Checking master and sybsystemprocs  I've found the following sp :

"sp_aux_checkroleperm"


but I cannot find information related to it in the product manuals.


Does anyone knows about it and what it's supposed to do?


Thank you

Regards

Jose

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member89972
Active Contributor
0 Kudos

SAP/Sybase has many a sub/helper procedures where logic is neatly packed so that it can be called from various places.  Manuals may not explain about the the sub/helper procedure(s).  e.g. sp_sysmon calls a number of procedures depending on options chosen.  But you will find documentation about sp_sysmon mostly.

SAP/Sybase has ( so far !)  not  hidden the source SQL of most of the stored procedures either. So if you are curious you can look at the code using the technique Bret shows above.

So the source code above and the name of the procedure give you a hint of what is being done.

sp_depends for this procedure shows that it taps into configuration system tables and the proc itself is called by other system procedures like sp_dboption, sp_configure, sp_dropdevice etc...

HTH

Avinash

jmtorres
Active Participant
0 Kudos

Avinash/Bret

Thank you guys. Is just that didn't find it on ASE 15.7 GA. Only in 15.7 SP50 or higher.

Regards

Jose

former_member188958
Active Contributor
0 Kudos

sp_aux_checkroleperm is called as a subprocedure by many of the other system stored procedures.  The initial comment block describes what it does:

1> sp_helptext sp_aux_checkroleperm

2> go

# Lines of Text

---------------

              12

(1 row affected)

text

-------------------------------------------------------------------------------

----------------

/*

** SP_AUX_CHECKROLEPERM

** Checks if the user has a particular role or permission.  It does this

** check depending on whether granular permissions is enabled or not.  If

** it is not enabled then the role specified by @rolename will be checked

** o

therwise the permission specified by @role_perm_name will be checked.

** If a @rolename is NULL and granular permissions is not enabled or

** if granular permissions is enabled and @role_perm_name is NULL then

** it assumed that there was no role/permissi

on check required and a

** 0 is returned.

**

** Parameters:

**      @rolename       - Name of role to check for if granular permissions

**                        not enabled. If @rolename is "dbo" then we check

**                        to see if user_id() is 1.

**

**      @role_perm_name - Name of role

  or permission to check if granular

**                        permissions is enabled. When granular permissions is

**                        enabled some stored procedures require either a

**                        permission or a role.  In the case when checking for

**                        a role a rolename may be passed i

n instead of a

**                        permission name.

**

**      @dbname         - If not null then pass to has_privilege as database

**                        name to do the permission check in.

**      @gp_enabled     - (output) 0 if granular permissions is not enabled

**                        otherwise set to 1.

** Return

s:

**      0       - User has role or permission.

**      1       - role checked and user doesn't have it.

**      2       - permission checked and user doesn't have it.

** History:

**      August 2010     malloy  written.

*/