public virtual void RemoveUsers(ApplicationUser __item)
 {
     if (__item != null)
     {
         if (users.Contains(__item))
         {
             InternalRemoveUsers(__item);
         }
         if (__item.Permissions.Contains(this))
         {
             __item.RemovePermissions(this);
         }
     }
 }
예제 #2
0
 public void DeleteApplicationUser(zAppDev.DotNet.Framework.Identity.Model.ApplicationUser applicationuser, bool doNotCallDeleteForThis = false, bool isCascaded = false, object calledBy = null)
 {
     if (applicationuser == null || applicationuser.IsTransient())
     {
         return;
     }
     foreach (var toDelete in applicationuser.Clients)
     {
         applicationuser.RemoveClients(toDelete);
         DeleteApplicationClient(toDelete, false, isCascaded);
     }
     foreach (var toDelete in applicationuser.Logins)
     {
         applicationuser.RemoveLogins(toDelete);
         DeleteApplicationUserLogin(toDelete, false, isCascaded);
     }
     foreach (var toDelete in applicationuser.Claims)
     {
         applicationuser.RemoveClaims(toDelete);
         DeleteApplicationUserClaim(toDelete, false, isCascaded);
     }
     foreach (var toDissasociate in applicationuser.Permissions)
     {
         applicationuser.RemovePermissions(toDissasociate);
     }
     if (applicationuser.Profile != null)
     {
         var toDelete = applicationuser.Profile;
         applicationuser.Profile = null;
         DeleteProfile(toDelete, false, isCascaded, applicationuser);
     }
     foreach (var toDissasociate in applicationuser.Roles)
     {
         applicationuser.RemoveRoles(toDissasociate);
     }
     if (!doNotCallDeleteForThis)
     {
         Delete <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>(applicationuser, isCascaded);
     }
 }