Share via


clsMiningModelRole

Note

  This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.

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

You use objects of ClassType clsMiningModelRole to manage the set of users who can access a mining model and the manner in which they can access it. A mining model 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 mining models (mining model roles) by adding them to the collection of roles associated with the mining model.

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 mining model roles from the mining model's collection of role objects.

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

Examples

If dsoDb.DataSources("DMTest") Is Nothing Then
    Set dsoDs = dsoDb.DataSources.AddNew("DMTest")
    dsoDs.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=d:dmtest2.mdb"
    dsoDs.Update
End If
'Create a new mining model role.
If dsoDb.Roles("DMDev") Is Nothing Then
    Set dsoRole = dsoDb.Roles.AddNew("DMDev")
    dsoRole.UsersList = "DOMAIN\SomeUser"
    dsoRole.Update
End If

'Check to see whether the mining model exists.
If Not dsoDb.MiningModels("CustSalesRel") Is Nothing Then
    'Delete it if it does.
    dsoDb.MiningModels.Remove "CustSalesRel"
End If
'Now create the model afresh.
Set dsoDmm = dsoDb.MiningModels.AddNew("CustSalesRel")
'Add a new datasource for the model
dsoDmm.DataSources.AddNew "DMTest"
'Add a data mining role to the new mining model.
Set dsoRole = dsoDmm.Roles.AddNew("DMDev")