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.
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. 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.
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.
Suppose you define roles called “finance-managers,” “production-managers,” and “sales-managers” 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. Once 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 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
clsCubeRole | Role Interface |