Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Roles Permissions via DSO

Status
Not open for further replies.

dogg1023

Programmer
Apr 20, 2001
2
US
Hi,

I am trying to read cube level roles via DSO and Visual
Basic 6.0. At the very basic level, I wish to retrieve
the permissions of each role in a given cube.

I have looked at all of the examples on MSDN but they all
seem to "set" permissions, not "retrieve" them.

The code below I would think would loop through each role
in the cube and retrieve the permissions but the
permissions are coming up blank...
------------------------------------------------------
Dim dsoServer As DSO.Server
Dim dsoDatabase As DSO.Database
Dim dsoCube As DSO.Cube
Dim dsoRole As DSO.Role

'Connect to server
Set dsoServer = New DSO.Server
dsoServer.Connect (txtServerName.Text)

'Find database and cube
Set dsoDatabase = dsoServer.MDStores(<&quot;database&quot;>)
Set dsoCube = dsoDatabase.MDStores(<&quot;cube&quot;>)

For Each dsoRole In dsoCube.Roles
Text1 = Text1 & dsoRole.Name & &quot;:&quot; &
dsoRole.Permissions(dsoRole.Name) & vbCrLf
Next
-------------------------------------------------------
....thank you in advance for any help.

Derek.
 
I have done this using the code below. However, one pitfall you might run in to (if memory serves) is that you are running this as your all-powerful administrator self, as as a result have no limitations. Make sure that the user you test on is a wimpy non-administrative, local user. (you are going to have to re-login as this user)



Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCube As DSO.MDStore
Dim dsoRole As DSO.Role

' Connect to the local server.
dsoServer.Connect &quot;LocalHost&quot;

' Connect to the TestDB database.
Set dsoDB = dsoServer.MDStores.Item(&quot;FoodMart 2000&quot;)

' Connect to the TestCube cube.
Set dsoCube = dsoDB.MDStores(&quot;Budget&quot;)


' Create a new cube role named TestRole, based on the database role
' named TestRole.
txtCount.Text = dsoCube.Roles.Count
With dsoCube.Roles
Set dsoRole = .Item(2)
txtName.Text = dsoRole.Name '.Item(2).Name
txtFoo.Text = dsoRole.UsersList '.Item(2).UsersList
txtBar.Text = dsoRole.Permissions(&quot;CellWrite&quot;)
End With
 
Hi,

Thanks for the code. I've been playing around with it and found that it is helpful in returning whether the user has Read/Write type of privileges.

What we are looking for is to pull back the &quot;Restricted Dimension&quot; from the roles in the cube. I had plugged that in here... txtBar.Text = dsoRole.Permissions(&quot;Restricted Dimensions&quot;)... but it did not return anything.

Do you know of a way to pull back the &quot;Restricted Dimensions&quot; of the roles?

Thank you,
Derek.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top