Ejemplo n.º 1
0
        protected void DoDelete(object sender, EventArgs e)
        {
            if (this.gridMain.SelectedKeys.Count > 0)
            {
                string unitID    = Request.QueryString["unitId"];
                string scopeType = Request.QueryString["schemaType"];

                try
                {
                    AU.AUAdminScope scope = (AU.AUAdminScope)AU.Adapters.AUSnapshotAdapter.Instance.LoadAUScope(unitID, scopeType, true, DateTime.MinValue).FirstOrDefault();
                    if (scope == null || scope.Status != SchemaObjectStatus.Normal)
                    {
                        throw new AUObjectException("指定的管理范围不存在");
                    }

                    var items = AU.Adapters.AUSnapshotAdapter.Instance.LoadScopeItems(this.gridMain.SelectedKeys.ToArray(), scopeType, true, DateTime.MinValue);

                    foreach (var item in items)
                    {
                        AU.Operations.Facade.InstanceWithPermissions.RemoveObjectFromScope((AU.AUAdminScopeItem)item, scope);
                    }
                }
                catch (Exception ex)
                {
                    WebUtility.ShowClientError(ex);
                }
            }

            this.InnerRefreshList();
        }
 private void ImportConditions(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, Operations.IFacade exec, ImportContextWrapper wrapper, int totalSteps, AdminUnit unit, int currentStep, AUAdminScope[] scopes)
 {
     if (this.IncludeScopeConditions)
     {
         wrapper.SetStatusAndLog(currentStep, totalSteps, "正在导入管理单元管理范围条件" + unit.GetQualifiedName());
         foreach (AUAdminScope sc in scopes)
         {
             var conditions = (from c in objectSet.Conditions where c.OwnerID == sc.ID select c);
             foreach (var c in conditions)
             {
                 DBTimePointActionContext.Current.DoActions(() => exec.UpdateScopeCondition(sc, c));
             }
         }
     }
 }
Ejemplo n.º 3
0
        internal static AUAdminScope FindMatchScope(IEnumerable <AUAdminScope> scopes, string name)
        {
            AUAdminScope result = null;

            foreach (var item in scopes)
            {
                if (item.ScopeSchemaType == name)
                {
                    result = item;
                    break;
                }
            }

            return(result);
        }
Ejemplo n.º 4
0
        private static void CopyMembers(bool copyMembers, AU.AUAdminScope item, AU.AUAdminScope targetScope, StepContext context)
        {
            if (copyMembers)
            {
                context.Logger.WriteLine(ProcessProgress.Current.StatusText = "正在复制管理范围固定成员");
                ProcessProgress.Current.Response();
                var memberIDs     = AU.AUCommon.DoDbProcess(() => PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(item.ID, item.ScopeSchemaType)).ToIDArray();
                var actualMembers = AU.Adapters.AUSnapshotAdapter.Instance.LoadScopeItems(memberIDs, item.ScopeSchemaType, true, DateTime.MinValue);
                context.ResetInnerSteps(actualMembers.Count);

                foreach (AU.AUAdminScopeItem scopeItem in actualMembers)
                {
                    context.Logger.WriteLine("正在添加" + scopeItem.AUScopeItemName);
                    AU.Operations.Facade.InstanceWithPermissions.AddObjectToScope(scopeItem, targetScope);
                    context.InnerStep++;
                    context.Response();
                }
            }
        }
Ejemplo n.º 5
0
        private static void CopyConditions(bool copyScopeConditions, AU.AUAdminScope srcScope, AU.AUAdminScope targetScope, StepContext context)
        {
            if (copyScopeConditions)
            {
                context.Logger.WriteLine(ProcessProgress.Current.StatusText = "正在复制管理范围条件成员");
                ProcessProgress.Current.Response();

                var srcCondition = AU.Adapters.AUConditionAdapter.Instance.Load(srcScope.ID, AU.AUCommon.ConditionType).Where(m => m.Status == SchemaObjectStatus.Normal).FirstOrDefault();
                if (srcCondition != null)
                {
                    AU.Operations.Facade.InstanceWithPermissions.UpdateScopeCondition(targetScope, new PC.Conditions.SCCondition()
                    {
                        Condition   = srcCondition.Condition,
                        Description = srcCondition.Description,
                        OwnerID     = targetScope.ID,
                        Type        = AU.AUCommon.ConditionType,
                        SortID      = 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);
		}