コード例 #1
0
ファイル: Roles.cs プロジェクト: dox0/DotNet471RS3
        static public void RemoveUsersFromRole(string[] usernames, string roleName)
        {
            EnsureEnabled();

            SecUtility.CheckParameter(ref roleName, true, true, true, 0, "roleName");

            SecUtility.CheckArrayParameter(ref usernames,
                                           true,
                                           true,
                                           true,
                                           0,
                                           "usernames");

            Provider.RemoveUsersFromRoles(usernames, new string[] { roleName });
            try
            {
                RolePrincipal user = GetCurrentUser() as RolePrincipal;
                if (user != null && user.ProviderName == Provider.Name && user.IsRoleListCached)
                {
                    foreach (string username in usernames)
                    {
                        if (StringUtil.EqualsIgnoreCase(user.Identity.Name, username))
                        {
                            user.SetDirty();
                            break;
                        }
                    }
                }
            }
            catch { }
        }
コード例 #2
0
 public static void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
 {
     EnsureEnabled();
     SecUtility.CheckArrayParameter(ref roleNames, true, true, true, 0, "roleNames");
     SecUtility.CheckArrayParameter(ref usernames, true, true, true, 0, "usernames");
     Provider.RemoveUsersFromRoles(usernames, roleNames);
     try
     {
         RolePrincipal currentUser = GetCurrentUser() as RolePrincipal;
         if (((currentUser != null) && (currentUser.ProviderName == Provider.Name)) && currentUser.IsRoleListCached)
         {
             foreach (string str in usernames)
             {
                 if (System.Web.Util.StringUtil.EqualsIgnoreCase(currentUser.Identity.Name, str))
                 {
                     currentUser.SetDirty();
                     return;
                 }
             }
         }
     }
     catch
     {
     }
 }
コード例 #3
0
 public static void RemoveUserFromRole(string username, string roleName)
 {
     EnsureEnabled();
     SecUtility.CheckParameter(ref roleName, true, true, true, 0, "roleName");
     SecUtility.CheckParameter(ref username, true, true, true, 0, "username");
     Provider.RemoveUsersFromRoles(new string[] { username }, new string[] { roleName });
     try
     {
         RolePrincipal currentUser = GetCurrentUser() as RolePrincipal;
         if (((currentUser != null) && (currentUser.ProviderName == Provider.Name)) && (currentUser.IsRoleListCached && System.Web.Util.StringUtil.EqualsIgnoreCase(currentUser.Identity.Name, username)))
         {
             currentUser.SetDirty();
         }
     }
     catch
     {
     }
 }
コード例 #4
0
ファイル: Roles.cs プロジェクト: samcf111/unityMono5.5.0
 public static void RemoveUsersFromRoles(string [] usernames, string [] roleNames)
 {
     Provider.RemoveUsersFromRoles(usernames, roleNames);
 }
コード例 #5
0
ファイル: Roles.cs プロジェクト: samcf111/unityMono5.5.0
 public static void RemoveUsersFromRole(string [] usernames, string roleName)
 {
     Provider.RemoveUsersFromRoles(usernames, new string[] { roleName });
 }
コード例 #6
0
ファイル: Roles.cs プロジェクト: samcf111/unityMono5.5.0
 public static void RemoveUserFromRoles(string username, string [] roleNames)
 {
     Provider.RemoveUsersFromRoles(new string[] { username }, roleNames);
 }
コード例 #7
0
 public static void RemoveUserFromRole(string username, string rolename)
 {
     Provider.RemoveUsersFromRoles(new string[] { username }, new string[] { rolename });
 }