Beispiel #1
0
        public bool RemoveRole(string user, string application, string role)
        {
            //_provider.Initialize("AuthorizationRoleProvider", ConfigureAuthorizationRoleProvider("CATS", ""));
            //var provider = ((NetSqlAzMan.Providers.NetSqlAzManRoleProvider)Roles.Provider);
            var provider = new NetSqlAzManRoleProvider();

            provider.Initialize("RoleProvider", ConfigureAuthorizationRoleProvider("CATS", ""));
            var users     = new string[] { user };
            var userRoles = new string[] { role };

            provider.ApplicationName = application;
            provider.RemoveUsersFromRoles(users, userRoles);


            //const string store = "CATS";

            //string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["CatsContext"].ConnectionString;
            //IAzManStorage storage = new SqlAzManStorage(connectionString);
            //IAzManStore mystore = storage.GetStore("CATS"); //or storage["My Store"]
            //IAzManApplication myapp = mystore.GetApplication(application);

            //IAzManItem azManRole = myapp.GetItem(role);
            //try
            //{
            //    azManRole.DeleteDelegateAuthorization(
            //                                         mystore.GetDBUser(user),
            //                                         mystore.GetDBUser("Admin").CustomSid,
            //                                         RestrictedAuthorizationType.Allow
            //                                     );
            //}
            //catch(Exception ex)
            //{

            //}


            //azManRole.DeleteDelegateAuthorization();
            //azManRole.DeleteDelegateAuthorization();

            return(true);
        }
Beispiel #2
0
        private readonly IAzManStorage _store;              //= new NetSqlAzMan.SqlAzManStorage(System.Configuration.ConfigurationManager.ConnectionStrings["SecurityContext"].ConnectionString);

        public UserAccountService(IUnitOfWork unitOfWork, IAzManStorage store, NetSqlAzManRoleProvider provider)
        {
            this._unitOfWork = unitOfWork;
            this._store      = store;
            this._provider   = provider;
        }