Delete An Authorization

Topics: NetSqlAzMan Core
Feb 23, 2011 at 7:49 AM

Hi.

How Can I Delete An Authorization From a User?

i am using this code to create an authorization for a user .

Public Overloads Function AddUsersToRoles(ByVal Users As List(Of String), ByVal Roles As List(Of String)) As Boolean
            Dim FromDate As Date = Nothing
            Dim ToDate As Date = Nothing
            For Each user In Users
                For Each Role In Roles
                    Dim SelectedRole As IAzManItem = Storage(StoreName).Applications(ApplicationName
                                                                                     ).GetItem(Role)
                    Dim SelectedUser As NetSqlAzMan.Interfaces.IAzManDBUser = Storage.GetDBUser(user)
                    Dim auth As IAzManAuthorization = SelectedRole.CreateAuthorization(SqlAzManSID.NewSqlAzManSid(), _
                                                                   WhereDefined.Database, SelectedUser.CustomSid, _
                                                                   WhereDefined.Database, AuthorizationType.Allow, _
                                                                  IIf(FromDate = Nothing, New DateTime(2006, 1, 1), FromDate), _
                                                                  IIf(ToDate = Nothing, New DateTime(9999, 12, 31), ToDate))
                Next
            Next
            Return True
        End Function

But there is no function with the name "DeleteAuthorization" .

i did not find anything in Documentation and other Discussions.

Regards Shaahin.

Coordinator
Feb 23, 2011 at 8:33 AM

Hi,

before you must retrieve the Authorization (IAzManAuthorization).

Then … invoke the IAzManAuthorization.Delete() method.

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com