472,348 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

Still Trying to Figure Out Identification of SQL Server Stored Proc. Permissions via VB

I've looked through many suggestions and partial examples all over
this newsgroup and still am not coming up with anything that does
specifically what I'm wanting to accomplish.

I'm writing a VB 6.0 application which uses SQL Server as the
back-end.

Here's an example of what I'm wanting to do...

A user accessing the VB GUI attempts to open a certain form. Code
runs behind the scenes in VB that checks the user's "Execute"
permissions on the stored procedure that retrives the data into the
form. If the user is determined to have "Execute" permissions to that
stored procedure, the user is allowed to proceed with opening the
form. If they don't have permissions, they are informed of this and
aren't allowed to open the form and view the data.

Let's say that we initially determine through the VB code that the
user has the ability to "Execute" the stored procedure that allows for
viewing of the data. We go ahead and let them open the form. Once
the form is being opened though, we run VB code to check for their
permissions on other stored procedure that can be used in UPDATING /
INSERTING / DELETING the records being displayed in the form. If they
don't have "Execute" permissions on these particular
Update/Insert/Delete stored procedures, then I'll have a text box on
the form show as visible to advise them while they're looking at this
data that they can't do anything to this data other than view it...
they can't insert new records, they can't delete any records, and they
can't update any records.

I have yet to find specific code that tells me how to check
permissions on a storedc procedure for the user that's logged-in, what
the resulting codes (i.e. 12291, etc.) mean as far as identification
of their permissions, etc.

If anyone can help me out here, I'd greatly appreciate it. I'd hate
to just have to resort to trying to allow the user to run the stored
procedures and just trap the error codes that may arise once each
stored procedure is executed and inform the user on the tail-end of
the process that they can't run the stored procedure. I'd like to
identify their permissions to the stored procedures on the front-end
of the process either before each form is opened or just as it's
opening to advise them early as to what they can/can't do with the
data being displayed in the form.

Thanks in advance for any examples/information!

Sincerely,
Brad H. McCollum
bm******@midsouth.rr.com
Jul 20 '05 #1
1 1907
[posted and mailed, posted and mailed]

Brad H McCollum (bm******@midsouth.rr.com) writes:
I have yet to find specific code that tells me how to check
permissions on a storedc procedure for the user that's logged-in, what
the resulting codes (i.e. 12291, etc.) mean as far as identification
of their permissions, etc.


If the expresion:

permissions(object_id('dbo.yourprocedure')) & 0x20

returns a non-zero value, the user has permission to execute the procedure,
else not.

You can read more about the Permissions() function Books Online.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Greg D. Moore \(Strider\) | last post by:
Ok, I thought this one would be easy. I have a stored proc: master.dbo.restore_database_foo This is on database server B. Database server A...
2
by: aaj | last post by:
Hi all I have a stored procedure that has the line EXEC master..xp_cmdshell 'dtsrun /Stestjob1 /N testdts /E' If I run the SP from an access...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data...
2
by: David C | last post by:
I have an aspx page with an editible GridView. When I click the Update button the stored procedure runs (I know because the underlying data was...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.