示例#1
0
        public void ReplaceUsersInRole(ClientGenericObject[] users, ClientAdminUnit unit, ClientAUSchemaRole role)
        {
            users.NullCheck("users"); unit.NullCheck("unit"); role.NullCheck("role");
            CheckIDProvided(unit); CheckIDProvided(role);
            SCUser[] scUsers = new SCUser[users.Length];
            for (int i = users.Length - 1; i >= 0; i--)
            {
                scUsers[i] = (SCUser)users[i].ToSchemaObject();
            }

            this.Facade.ReplaceUsersInRole(scUsers, (AdminUnit)unit.ToSchemaObject(), (AUSchemaRole)role.ToSchemaObject());
        }
示例#2
0
        public void AddAdminUnit(ClientAdminUnit unit, ClientAdminUnit parent)
        {
            EnsureID(unit);

            if (parent != null)
            {
                CheckIDProvided(parent);
            }

            AdminUnit auParent = parent != null ? (AdminUnit)parent.ToSchemaObject(true) : null;

            this.Facade.AddAdminUnit((AdminUnit)unit.ToSchemaObject(false), auParent);
        }
示例#3
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());
        }
示例#4
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());
        }
示例#5
0
        public void AddAdminUnitWithMembers(ClientAdminUnit unit, ClientAdminUnit parent, ClientAURole[] roles, ClientAUAdminScope[] scopes)
        {
            roles.NullCheck("roles");
            scopes.NullCheck("scopes");
            CheckIDProvided(unit);

            AURole[] auRoles = new AURole[roles.Length];
            for (int i = roles.Length - 1; i >= 0; i--)
            {
                auRoles[i] = (AURole)roles[i].ToSchemaObject();
            }

            AUAdminScope[] auScopes = new AUAdminScope[scopes.Length];
            for (int i = scopes.Length - 1; i >= 0; i--)
            {
                auScopes[i] = (AUAdminScope)scopes[i].ToSchemaObject();
            }

            EnsureID(unit);
            AdminUnit auParent = parent != null ? (AdminUnit)parent.ToSchemaObject(true) : null;

            this.Facade.AddAdminUnitWithMembers((AdminUnit)unit.ToSchemaObject(false), auParent, auRoles, auScopes);
        }
示例#6
0
 public void DeleteAdminUnit(ClientAdminUnit unit)
 {
     CheckIDProvided(unit);
     this.Facade.DeleteAdminUnit((AdminUnit)unit.ToSchemaObject(true));
 }
示例#7
0
 public void MoveAdminUnit(ClientAdminUnit unit, ClientAdminUnit newParent)
 {
     CheckIDProvided(unit);
     CheckIDProvided(newParent);
     this.Facade.MoveAdminUnit((AdminUnit)unit.ToSchemaObject(true), (AdminUnit)newParent.ToSchemaObject(true));
 }
		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());
		}
		public void ReplaceUsersInRole(ClientGenericObject[] users, ClientAdminUnit unit, ClientAUSchemaRole role)
		{
			users.NullCheck("users"); unit.NullCheck("unit"); role.NullCheck("role");
			 CheckIDProvided(unit); CheckIDProvided(role);
			SCUser[] scUsers = new SCUser[users.Length];
			for (int i = users.Length - 1; i >= 0; i--)
				scUsers[i] = (SCUser)users[i].ToSchemaObject();

			this.Facade.ReplaceUsersInRole(scUsers, (AdminUnit)unit.ToSchemaObject(), (AUSchemaRole)role.ToSchemaObject());
		}
		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());
		}
		public void DeleteAdminUnit(ClientAdminUnit unit)
		{
			CheckIDProvided(unit);
			this.Facade.DeleteAdminUnit((AdminUnit)unit.ToSchemaObject(true));
		}
		public void MoveAdminUnit(ClientAdminUnit unit, ClientAdminUnit newParent)
		{
			CheckIDProvided(unit);
			CheckIDProvided(newParent);
			this.Facade.MoveAdminUnit((AdminUnit)unit.ToSchemaObject(true), (AdminUnit)newParent.ToSchemaObject(true));
		}
		public void AddAdminUnitWithMembers(ClientAdminUnit unit, ClientAdminUnit parent, ClientAURole[] roles, ClientAUAdminScope[] scopes)
		{
			roles.NullCheck("roles");
			scopes.NullCheck("scopes");
			CheckIDProvided(unit);

			AURole[] auRoles = new AURole[roles.Length];
			for (int i = roles.Length - 1; i >= 0; i--)
				auRoles[i] = (AURole)roles[i].ToSchemaObject();

			AUAdminScope[] auScopes = new AUAdminScope[scopes.Length];
			for (int i = scopes.Length - 1; i >= 0; i--)
				auScopes[i] = (AUAdminScope)scopes[i].ToSchemaObject();

			EnsureID(unit);
			AdminUnit auParent = parent != null ? (AdminUnit)parent.ToSchemaObject(true) : null;

			this.Facade.AddAdminUnitWithMembers((AdminUnit)unit.ToSchemaObject(false), auParent, auRoles, auScopes);
		}
		public void AddAdminUnit(ClientAdminUnit unit, ClientAdminUnit parent)
		{
			EnsureID(unit);

			if (parent != null)
				CheckIDProvided(parent);

			AdminUnit auParent = parent != null ? (AdminUnit)parent.ToSchemaObject(true) : null;
			this.Facade.AddAdminUnit((AdminUnit)unit.ToSchemaObject(false), auParent);
		}