Ejemplo n.º 1
0
        // // [PolicyPermission(System.Security.Permissions.SecurityAction.Demand, PolicyId = PermissionPolicyIdentifiers.AlterIdentity)]
        internal static void Userdel(GenericUserParms parms)
        {
            if (parms.UserName == null)
            {
                throw new InvalidOperationException("Must specify a user");
            }

            foreach (var un in parms.UserName)
            {
                var user = m_client.GetUsers(o => o.UserName == un).CollectionItem.FirstOrDefault() as SecurityUserInfo;
                if (user == null)
                {
                    throw new KeyNotFoundException($"User {un} not found");
                }

                m_client.DeleteUser(user.Entity.Key.Value);
            }
        }