473,386 Members | 1,734 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,386 software developers and data experts.

Table privilege

332 100+
In Access 2003, is there a way to get a list of table privileges (read, update, insert, delete) for a given group as defined in the security wizard.

All I can find around is security relationships between users and groups. That's the easy part.

Well, this is what I quickly hacked as a starting point.
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Function GetTablePrivilage()
  5. Dim cat As ADOX.Catalog
  6. Dim perm As Long
  7. Dim Ws As Workspace
  8. Dim i As Integer
  9. Dim t As Integer
  10. Dim db As DAO.Database
  11. Dim mytbl As TableDef
  12. Set db = CurrentDb
  13. Open "C:\privileges.html" For Output As #1
  14.  
  15. Print #1, "<html><style>"
  16. Print #1, "body{margin:0; padding:0;}"
  17. Print #1, "table{border:1px solid black; border-collapse:collapse;}"
  18. Print #1, "td {border:1px solid black; padding:0 4px 0 4px;}"
  19. Print #1, "</style>"
  20. Print #1, "<table>"
  21. Set Ws = DBEngine.Workspaces(0)
  22. Set cat = New ADOX.Catalog
  23. With cat
  24.     For i = 0 To Ws.Groups.Count - 1
  25.         Print #1, "<tr><th colspan='3'>"
  26.         Print #1, "Group " & Ws.Groups(i).Name
  27.         Print #1, "</tr>"
  28.         For Each mytbl In db.TableDefs
  29.             If Left(mytbl.Name, 4) <> "MSys" Then
  30.                 .ActiveConnection = CurrentProject.Connection
  31.                 perm = .Groups(Ws.Groups(i).Name).GetPermissions(mytbl.Name, adPermObjTable)
  32.                 If perm <> 0 Then
  33.                     Print #1, "<tr><td>" & mytbl.Name & "</td><td>" & perm & "</td><td>" & privilegeToText(perm) & "</td></tr>"
  34.                 End If
  35.             End If
  36.         Next mytbl
  37.     Next i
  38. End With
  39. Print #1, "<html><table>"
  40. Close #1
  41. End Function
  42.  
  43. Function privilegeToText(privilege As Long) As String
  44. Select Case privilege
  45.     Case -2147482624
  46.         privilegeToText = "read data"
  47.     Case -1073740800
  48.         privilegeToText = "update data"
  49.     Case -2147449856
  50.         privilegeToText = "insert data"
  51.     Case -2147417088
  52.         privilegeToText = "delete data"
  53.     Case 1024
  54.         privilegeToText = "read design"
  55.     Case -1073672960
  56.         privilegeToText = "modify design"
  57.     Case -1072853760
  58.         privilegeToText = "administer"
  59.     Case -1073675264
  60.         privilegeToText = "delete & update data"
  61.     Case -1073642496
  62.         privilegeToText = "read, update, insert, delete"
  63.     Case -2147384320
  64.         privilegeToText = "read, insert, delete data"
  65.     Case -1072706304
  66.         privilegeToText = "Administer"
  67.     Case -1073708032
  68.         privilegeToText = "read, update, insert"
  69.     Case 147456
  70.         privilegeToText = "No privilege"
  71.     Case Else
  72.         privilegeToText = "NOT DEFINED"
  73. End Select
  74.  
  75. End Function
Jun 19 '12 #1
1 1662
zmbd
5,501 Expert Mod 4TB
Mariostg:

This was a fairly difficult one one for me to find...

I think that you should be able to step thru the object using something along the lines of cat.getobjectowner(strObjectName, adpermobjtable) which is what I've done when checking users against a table...

for a fairly techie level of information on the security model try here: http://www.grahamwideman.com/gw/tech...ssec/index.htm

You should also take a look at what you can read here... look about page 356/357:
http://books.google.com/books?id=TdJ...0group&f=false

-z
Aug 27 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ping | last post by:
Hello, Have a wonderful new year! I have oracle 9.2 on XP. There is a table T1 created by user U1 in U1's schema, a synonym S1 created also by U1 to point to T1 in U1's schema, U1 granted...
0
by: Tiffany Wilkes | last post by:
I solved the problem--I needed ( ) around the column list. I think the manual should make that more clear. -------- Original Message -------- Subject: column privilege problem Date: Tue, 05...
4
by: Michael Jackson | last post by:
I have a stored procedure to create a table. In my program I want the user to name the table to be created, therefore I pass a parameter to the SP for the table name. I cannot get it to work. It...
4
by: Sergey Suleymanov | last post by:
Documentation says "By default, only the owner (creator) of the function has the right to execute it." But for me newly created function has execute privilege to public by default. And we have...
1
by: xixi | last post by:
There is one thing I don't understand, I have default tablespace userspace1 is database managed type, with total freepages 506048. another one called tmpxx is DMS type too, with 525120 free pages....
1
by: Jim | last post by:
Hi, I want to add a field to a table in a database that is live and being accessed from the web. I'm using phpMyAdmin and when I try to add the field I get error #1142...
5
by: shsandeep | last post by:
I have given 'SELECT','INSERT' privileges to a user 'group' for a set of tables. But a user gets a prompt that he does not the 'SELECT' privilege on that particular table. The user does belong...
3
by: %NAME% | last post by:
Suppose I am an admin of a database instance. Now I need to specify that user A has the right to create tables in his own schema, but not anywhere else. In order to let user A create tables, i...
2
by: prosad | last post by:
hi! Am having a problem inserting password after encrypting into a column of a table. am using MySQL. $loginid = $_POST; $password = $_POST; $encrypt_password = md5($password); if ($_POST)...
3
by: Rahul B | last post by:
Hi, I have a user UCLDEV1 which is a part of staff and a group(db2schemagrp1) to which i have not given any permissions. The authorizations of that user are shown as db2 =get authorizations...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.