コード例 #1
0
        public void RemoveUserFromRole(ClientGenericObject user, ClientAdminUnit unit, ClientAUSchemaRole role)
        {
            user.NullCheck("user"); unit.NullCheck("unit"); role.NullCheck("role");
            CheckIDProvided(user); CheckIDProvided(unit); CheckIDProvided(role);

            SCUser scUser = new SCUser()
            {
                ID       = user.ID,
                Name     = user.Properties.GetValue("Name", string.Empty),
                CodeName = user.Properties.GetValue("CodeName", string.Empty)
            };

            this.Facade.RemoveUserFromRole(scUser, (AdminUnit)unit.ToSchemaObject(), (AUSchemaRole)role.ToSchemaObject());
        }
コード例 #2
0
        public void AddUserToRole(ClientGenericObject user, ClientAdminUnit unit, ClientAUSchemaRole role)
        {
            user.NullCheck("user"); unit.NullCheck("unit"); role.NullCheck("role");
            CheckIDProvided(user); CheckIDProvided(unit); CheckIDProvided(role);

            if (string.IsNullOrEmpty(user.ID))
            {
                throw new ArgumentException("user的ID必须不为null", "user");
            }

            SCUser scUser = new SCUser()
            {
                ID       = user.ID,
                Name     = user.Properties.GetValue("Name", string.Empty),
                CodeName = user.Properties.GetValue("CodeName", string.Empty)
            };

            this.Facade.AddUserToRole(scUser, (AdminUnit)unit.ToSchemaObject(), (AUSchemaRole)role.ToSchemaObject());
        }