clsCubeRole

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

Remarks

clsCubeRole objects are used to manage the set of users who can access a cube and the manner in which they can access it. A cube 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. Cube roles can be used with virtual cubes and regular cubes.

You create roles at the database level (database roles) and then assign them to cubes (cube roles) by adding them to the collection of roles associated with the cube. The roles assigned to a cube automatically apply 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 roles from the cube’s collection of role objects.

You can remove a cube role by removing it from the cube’s collection of role objects. When you do so, the corresponding database role is not affected. However, the definition of the cube role remains in effect until you update or process the cube.

Example

Suppose you want to define roles called “finance-managers,” “production-managers,” and “sales-managers” at the database level. Suppose also that you want to 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. Finally, suppose that you want to create a cube for each year's financial, production, and sales data for the years 1995, 1996, and 1997.

Use the following code to define the appropriate database and cube roles for this situation.


Note User lists defined for database roles are automatically associated with the corresponding cube roles and cannot be changed at the cube role level.


'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 SbRole_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
clsDatabaseRole Role Interface

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.