Here's the scenario:
- I have an Access 2003 (.MDB) database with User Level Security
- I have a group G and a form F
- Through "User and Group Permissions" dialog box, I explicitely set Open/Run permission (and only that) for group G on form F
- I log in as user U (a member of group G) and can open the form F
- In VBA I set an ADOX.Catalog variable cat to the current database and expect that the following call return something like adRightExecute (i.e.: 0x20000000); but it returns 0 (the last parameter is the GUID that designates Forms):
cat.Groups("G").GetPermissions("F", adPermObjProviderSpecific, "{c49c842e-9dcb-11d1-9f0a-00c04fc2c2e0}")
I googled the issue in whatever creative search method I knew and was surprised that this case has not been addressed during the two decades that ADO is around!... So probably I am doing something wrong.
I would greatly appreciate if anyone could give me a hint.
UPDATE:
Function GetPermissionsGroupForm(groupName As String, formName As String) As Long
Dim cat As ADOX.Catalog
Set cat = New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
GetPermissionsGroupForm = _
cat.Groups(groupName).GetPermissions( _
formName, _
adPermObjProviderSpecific, _
"{c49c842e-9dcb-11d1-9f0a-00c04fc2c2e0}")
End Function
GetPermissionsGroupForm("G", "F")
returns 0 (equally with ADOX 2.8 and 6.0)
UPDATE 2:
For information, the structure of ADOX Permissions (Long) is:
BIT | Value | Meaning |
---|---|---|
00 | 0x00000001 | NOT USED |
01 | 0x00000002 | NOT USED |
02 | 0x00000004 | NOT USED |
03 | 0x00000008 | NOT USED |
04 | 0x00000010 | NOT USED |
05 | 0x00000020 | NOT USED |
06 | 0x00000040 | NOT USED |
07 | 0x00000080 | NOT USED |
08 | 0x00000100 | adRightDrop |
09 | 0x00000200 | adRightExclusive |
10 | 0x00000400 | adRightReadDesign |
11 | 0x00000800 | adRightWriteDesign |
12 | 0x00001000 | adRightWithGrant |
13 | 0x00002000 | adRightReference |
14 | 0x00004000 | adRightCreate |
15 | 0x00008000 | adRightInsert |
16 | 0x00010000 | adRightDelete |
17 | 0x00020000 | adRightReadPermissions |
18 | 0x00040000 | adRightWritePermissions |
19 | 0x00080000 | adRightWriteOwner |
20 | 0x00100000 | NOT USED |
21 | 0x00200000 | NOT USED |
22 | 0x00400000 | NOT USED |
23 | 0x00800000 | NOT USED |
24 | 0x01000000 | NOT USED |
25 | 0x02000000 | adRightMaximumAllowed |
26 | 0x04000000 | NOT USED |
27 | 0x08000000 | NOT USED |
28 | 0x10000000 | adRightFull |
29 | 0x20000000 | adRightExecute |
30 | 0x40000000 | adRightUpdate |
31 | 0x80000000 | adRightRead |
I desperately tried all NOT USED bits and some combinations of the defined ones in order to set the Open/Run
permission through SetPermissions
... No success!