473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1962
[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 backs up database foo on a daily basis as 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 front end as a trusted user or from a scheduled...
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 from/to SQL Server? Why? Thanks Regards
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 changed) but throws an exception as follows: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.