clsDatabaseRole

Analysis Services Programming

Analysis Services Programming

clsDatabaseRole

An object of ClassType clsDatabaseRole provides a specific implementation of the Decision Support Objects (DSO) Role interface. This object provides collections, methods, and properties through the Role interface.

Remarks

Objects of ClassType clsDatabaseRole are used to manage the set of users who can access a database and the manner in which they can access it. As with cube roles and mining model roles, a database role has a name, a description, a parent object, a class type, a list of users, and a set of permissions. Each permission has a key and a corresponding permission expression.

Unlike cube roles and mining model roles, however, a database role serves as the basis for cube and mining model roles. To create roles for cubes and data mining models, create roles at the database level (database roles) and then assign them to cubes or mining models by adding them to the collection of roles associated with the cube or mining model. The act of assigning database roles to cubes or mining models creates corresponding cube roles and mining model roles based on the database role. The roles assigned to a cube apply automatically to its partitions and aggregations.

You can remove a database role by removing it from the database's collection of role objects. When you do so, the system automatically removes the corresponding cube and mining model roles from the cube's collection of role objects.

Example

Suppose you define roles named FinanceManagers, ProductionManagers, and SalesManagers at the database level. Suppose also that you assign the appropriate vice president to the list of users for each role and the company president to the list of users for all three roles.

Use the following code to define the appropriate database and cube roles for this situation. After the code has been executed, you can assign the database roles to cubes (or virtual cubes) as needed. For more information, see clsCubeRole

' Assume an object (dsoDB) of ClassType clsDatabase exists.
' Create database roles.
Dim DbRole_FinanceMgrs As DSO.Role
Dim DbRole_ProductionMgrs As DSO.Role
Dim DbRole_SalesMgrs As DSO.Role
Set DbRole_FinanceMgrs = dsoDB.Roles.AddNew("FinanceManagers")
Set DbRole_ProductionMgrs = dsoDB.Roles.AddNew("ProductionManagers")
Set DbRole_SalesMgrs = dsoDB.Roles.AddNew("SalesManagers")

' Define user lists for database roles.
' (In a real-world situation, actual user names would be
' used in place of titles like "President".)
DbRole_FinanceMgrs.UsersList = "President;VP_Finance"
DbRole_ProductionMgrs.UsersList = "President;VP_Production"
DbRole_SalesMgrs.UsersList = "President;VP_Sales"

' Update the repository for the database roles.
DbRole_FinanceMgrs.Update
DbRole_ProductionMgrs.Update
DbRole_SalesMgrs.Update

' Assume objects (Cube95, Cube96 and Cube97) of ClassType clsCube exist.
' Create cube roles. Cube role names must be identical
' to the corresponding database role names.
Dim CubeRole_FinanceMgrs As DSO.Role
Dim CubeRole_ProductionMgrs As DSO.Role
Dim CubeRole_SalesMgrs As DSO.Role

' Add roles to Cube95.
Set CubeRole_FinanceMgrs = Cube95.Roles.AddNew("FinanceManagers")
Set CubeRole_ProductionMgrs = Cube95.Roles.AddNew("ProductionManagers")
Set CubeRole_SalesMgrs = Cube95.Roles.AddNew("SalesManagers")

' Add Roles to Cube96.
Set CubeRole_FinanceMgrs = Cube96.Roles.AddNew("FinanceManagers")
Set CubeRole_ProductionMgrs = Cube96.Roles.AddNew("ProductionManagers")
Set CubeRole_SalesMgrs = Cube96.Roles.AddNew("SalesManagers")

' Add Roles to Cube97.
Set CubeRole_FinanceMgrs = Cube97.Roles.AddNew("FinanceManagers")
Set CubeRole_ProductionMgrs = Cube97.Roles.AddNew("ProductionManagers")
Set CubeRole_SalesMgrs = Cube97.Roles.AddNew("SalesManagers")

' Update the repository for the cubes.
Cube95.Update
Cube96.Update
Cube97.Update

See Also

Collections, clsDatabaseRole

Methods, clsDatabaseRole

Properties, clsDatabaseRole

Role Interface