private void CheckUnitPermission(AUOperationType opType, string permissionName, AdminUnit unit) { unit.NullCheck("unit"); if (unit.Status != SchemaObjectStatus.Normal) { throw new AUStatusCheckException(unit, opType); } if (this._NeedCheckPermissions) { if (unit == null || unit.Status != SchemaObjectStatus.Normal) { throw new ArgumentException(string.Format("不存在参数 unit 指定的管理单元", "unit")); } if (DeluxePrincipal.Current.HasPermissions(permissionName, new string[] { unit.ID }) == false) { //如果没有权限,检查是否超级管理员或者拥有架构权限 if (AUPermissionHelper.IsSupervisor(DeluxePrincipal.Current) == false) { var schema = unit.GetUnitSchema(); if (string.IsNullOrEmpty(schema.MasterRole) || DeluxePrincipal.Current.IsInRole(schema.MasterRole) == false) { throw CreateAclException(opType, unit.Schema, permissionName); } } } } }
public AUUpdateObjectAclExecutor(AUOperationType opType, SCAclContainer container) : base(opType) { container.NullCheck("container"); this._Container = container; }
public AUReplaceAclRecursivelyExecutor(AUOperationType opType, ISCAclContainer parent) : base(opType) { parent.NullCheck("parent"); this._Parent = parent; this.AutoStartTransaction = false; }
public AUSchemaExecutor(AUOperationType type, SchemaObjectBase schema) : base(type, schema) { if (type != AUOperationType.AddAdminSchema && type != AUOperationType.RemoveAdminSchema && type != AUOperationType.UpdateAdminSchema) { throw new NotSupportedException("不支持在此Executor中使用操作" + type); } }
public AUObjectExecutor(AUOperationType opType, SchemaObjectBase data) : base(opType) { data.NullCheck("data"); data.ClearRelativeData(); this._Data = data; }
public AURoleMemberExecutor(AUOperationType opType, AUSchemaRole role, AdminUnit unit, SCUser[] users) : base(opType) { role.NullCheck("role"); users.NullCheck("users"); unit.NullCheck("unit"); this.schemaRole = role; this.users = users; this.unit = unit; }
public AUSchemaRoleExecutor(AUOperationType type, AUSchema schema, AUSchemaRole data) : base(type, schema, data) { switch (type) { case AUOperationType.AddSchemaRole: case AUOperationType.RemoveSchemaRole: break; default: throw new ArgumentOutOfRangeException("type", string.Format("AUSchemaRoleExecutor不支持{0}操作", type)); } }
public AUMemberRelativeExecutorBase(AUOperationType opType, SchemaObjectBase container, SchemaObjectBase member) : base(opType, member) { container.NullCheck("container"); container.ClearRelativeData(); if (member != null) member.ClearRelativeData(); this._Container = container; this._Relation = PrepareRelationObject(container, member); }
public AUMemberRelativeExecutorBase(AUOperationType opType, SchemaObjectBase container, SchemaObjectBase member) : base(opType, member) { container.NullCheck("container"); container.ClearRelativeData(); if (member != null) { member.ClearRelativeData(); } this._Container = container; this._Relation = PrepareRelationObject(container, member); }
public AdminUnitExecutor(AUOperationType opType, AdminUnit parent, AdminUnit child) : base(opType, child) { child.NullCheck("child"); child.ClearRelativeData(); if (parent != null) parent.ClearRelativeData(); if (!(opType != AUOperationType.AddAdminUnit | opType != AUOperationType.RemoveAdminUnit)) throw new ApplicationException("此Executor不支持" + opType + "操作"); this.inputParent = parent; if (this.OperationType == AUOperationType.AddAdminUnit) this.aclContainer = PrepareAclContainer(parent, child); }
private void CheckUpdateAclPermissions(AUOperationType opType, string containerID) { if (this.NeedCheckPermissionAndCurrentUserIsNotSupervisor) { AdminUnit unit = null; AUCommon.DoDbAction(() => { unit = (AdminUnit)PC.Adapters.SchemaObjectAdapter.Instance.Load(containerID); }); if (unit == null || unit.Status != SchemaObjectStatus.Normal) { throw new AUObjectException("指定的管理单元不存在"); } CheckUnitPermission(opType, "EditSubUnitAcl", unit); } }
private SCAclPermissionCheckException CreateAclException(AUOperationType opType, SchemaDefine schemaInfo, string permissionName) { string opDesp = EnumItemDescriptionAttribute.GetDescription(opType); SCAclPermissionItem permissionInfo = schemaInfo.PermissionSet[permissionName]; string permissionDesp = string.Empty; if (permissionInfo != null) { permissionDesp = permissionInfo.Description; if (permissionDesp.IsNullOrEmpty()) { permissionDesp = permissionInfo.Name; } } return(new SCAclPermissionCheckException(string.Format("不能执行\"{0}\"操作,您没有\"{0}\"权限", opDesp, permissionDesp))); }
public AdminUnitExecutor(AUOperationType opType, AdminUnit parent, AdminUnit child) : base(opType, child) { child.NullCheck("child"); child.ClearRelativeData(); if (parent != null) { parent.ClearRelativeData(); } if (!(opType != AUOperationType.AddAdminUnit | opType != AUOperationType.RemoveAdminUnit)) { throw new ApplicationException("此Executor不支持" + opType + "操作"); } this.inputParent = parent; if (this.OperationType == AUOperationType.AddAdminUnit) { this.aclContainer = PrepareAclContainer(parent, child); } }
private void ExecuteWithActions(AUOperationType operationType, Action action) { AUCommon.DoDbAction(() => { MCS.Library.SOA.DataObjects.Security.Locks.SCDataOperationLockContext.Current.DoAddLockAction(this._AddLock, EnumItemDescriptionAttribute.GetDescription(operationType), () => { if (this._NeedExecuteActions && action != null) { AUObjectOperationActionCollection actions = AUObjectOperationActionSettings.GetConfig().GetActions(); actions.BeforeExecute(operationType); action(); actions.AfterExecute(operationType); } else { action(); } }); }); }
private void ExecuteWithActions(AUOperationType operationType, Action action) { AUCommon.DoDbAction(() => { MCS.Library.SOA.DataObjects.Security.Locks.SCDataOperationLockContext.Current.DoAddLockAction(this._AddLock, EnumItemDescriptionAttribute.GetDescription(operationType), () => { if (this._NeedExecuteActions && action != null) { AUObjectOperationActionCollection actions = AUObjectOperationActionSettings.GetConfig().GetActions(); actions.BeforeExecute(operationType); action(); actions.AfterExecute(operationType); } else action(); }); }); }
private void CheckUpdateAclPermissions(AUOperationType opType, string containerID) { if (this.NeedCheckPermissionAndCurrentUserIsNotSupervisor) { AdminUnit unit = null; AUCommon.DoDbAction(() => { unit = (AdminUnit)PC.Adapters.SchemaObjectAdapter.Instance.Load(containerID); }); if (unit == null || unit.Status != SchemaObjectStatus.Normal) throw new AUObjectException("指定的管理单元不存在"); CheckUnitPermission(opType, "EditSubUnitAcl", unit); } }
private SCAclPermissionCheckException CreateAclException(AUOperationType opType, SchemaDefine schemaInfo, string permissionName) { string opDesp = EnumItemDescriptionAttribute.GetDescription(opType); SCAclPermissionItem permissionInfo = schemaInfo.PermissionSet[permissionName]; string permissionDesp = string.Empty; if (permissionInfo != null) { permissionDesp = permissionInfo.Description; if (permissionDesp.IsNullOrEmpty()) permissionDesp = permissionInfo.Name; } return new SCAclPermissionCheckException(string.Format("不能执行\"{0}\"操作,您没有\"{0}\"权限", opDesp, permissionDesp)); }
private void CheckUnitPermission(AUOperationType opType, string permissionName, AdminUnit unit) { unit.NullCheck("unit"); if (unit.Status != SchemaObjectStatus.Normal) throw new AUStatusCheckException(unit, opType); if (this._NeedCheckPermissions) { if (unit == null || unit.Status != SchemaObjectStatus.Normal) throw new ArgumentException(string.Format("不存在参数 unit 指定的管理单元", "unit")); if (DeluxePrincipal.Current.HasPermissions(permissionName, new string[] { unit.ID }) == false) { //如果没有权限,检查是否超级管理员或者拥有架构权限 if (AUPermissionHelper.IsSupervisor(DeluxePrincipal.Current) == false) { var schema = unit.GetUnitSchema(); if (string.IsNullOrEmpty(schema.MasterRole) || DeluxePrincipal.Current.IsInRole(schema.MasterRole) == false) throw CreateAclException(opType, unit.Schema, permissionName); } } } }
public AUUpdateConditionsExecutor(AUOperationType opType, AUAdminScope scope, SCCondition condition) : base(opType) { (this.scope = scope).NullCheck("scope"); (this.condition = condition).NullCheck("condition"); }
/// <summary> /// 初始化 /// </summary> /// <param name="opType">操作类型</param> /// <param name="obj">要移动的管理单元</param> /// <param name="target">目标管理单元 或为 null 表示移动到Schema </param> public MoveAUExecutor(AUOperationType opType, AdminUnit obj, AdminUnit target) : base(opType) { (this._Object = obj).NullCheck("obj"); this._Target = target; }
public AUExecutorBase(AUOperationType opType) { this.OperationType = opType; }
public AUSchemaExecutor(AUOperationType type, SchemaObjectBase schema) : base(type, schema) { if (type != AUOperationType.AddAdminSchema && type != AUOperationType.RemoveAdminSchema && type != AUOperationType.UpdateAdminSchema) throw new NotSupportedException("不支持在此Executor中使用操作" + type); }
public AUMemberRelativeExecutor(AUOperationType opType, SchemaObjectBase container, SchemaObjectBase member) : base(opType, container, member) { }
/// <summary> /// 根据指定的操作类型和执行器初始化<see cref="SchemaObjectOperationContext"/>的新实例。 /// </summary> /// <param name="opType"><see cref="SCOperationType"/>值之一,表示操作的类型</param> /// <param name="executor"><see cref="SCExecutorBase"/>对象,表示操作</param> public AUObjectOperationContext(AUOperationType opType, AUExecutorBase executor) { this._OperationType = opType; this._Executor = executor; }
/// <summary> /// 执行之后 /// </summary> /// <param name="operationType"></param> public void AfterExecute(AUOperationType operationType) { this.ForEach(action => action.AfterExecute(operationType)); }
/// <summary> /// 执行之前 /// </summary> /// <param name="obj">一个<see cref="SchemaObjectBase"/>实例</param> public void BeforeExecute(AUOperationType operationType) { this.ForEach(action => action.BeforeExecute(operationType)); }
public AUStatusCheckException(SchemaObjectBase originalData, Executors.AUOperationType auOperationType) : base(GetMessage(originalData, auOperationType)) { this.originalData = originalData; this.auOperationType = auOperationType; }