Esempio n. 1
0
        protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext)
        {
            var excludeSubTree = this.Request.QueryString["superOf"];

            var exceptOrg = this.Request.QueryString["exceptOrg"];

            var exceptID = excludeSubTree ?? exceptOrg;

            bool godBehavior = callBackContext == "godMode";

            if (excludeSubTree != parentNode.Value)
            {
                PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentNode.Value }, false, true, false, DateTime.MinValue);

                var pmLimitString = this.Request.QueryString.Get("permission");

                var requiredPermissions = pmLimitString != null?pmLimitString.Split(',') : null;

                PC.Permissions.SCContainerAndPermissionCollection permissions = null;

                if (requiredPermissions != null)
                {
                    permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray());
                }

                BindObjectsToTreeNodes(relations, result, godBehavior, requiredPermissions, permissions, excludeSubTree, exceptID);
            }
        }
Esempio n. 2
0
        private static void PrepareTreeNodeRecursively(PC.SCSimpleObject parentOrg, DeluxeTreeNode parentTreeNode, Dictionary <string, PC.SCSimpleObject> parentsList, bool godMode, DateTime timePoint, string[] requiredPermissions, string excludeId, string exceptID)
        {
            if (excludeId != parentOrg.ID)
            {
                PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentOrg.ID }, false, true, false, timePoint);

                PC.Permissions.SCContainerAndPermissionCollection permissions = null;

                if (requiredPermissions != null)
                {
                    permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray());
                }

                BindObjectsToTreeNodes(relations, parentTreeNode.Nodes, godMode, requiredPermissions, permissions, excludeId, exceptID);

                foreach (DeluxeTreeNode childNode in parentTreeNode.Nodes)
                {
                    PC.SCSimpleObject obj = null;

                    if (parentsList.TryGetValue(childNode.Value, out obj))
                    {
                        childNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                        childNode.Expanded = true;

                        PrepareTreeNodeRecursively(obj, childNode, parentsList, godMode, timePoint, requiredPermissions, excludeId, exceptID);
                    }
                }
            }
        }
Esempio n. 3
0
        protected void dataSourceMain_Selected(object sender, ObjectDataSourceStatusEventArgs e)
        {
            System.Data.DataView view = e.ReturnValue as System.Data.DataView;
            if (view != null)
            {
                HashSet <string> parentIds      = new HashSet <string>();
                HashSet <string> deleteLimitIds = new HashSet <string>();
                foreach (System.Data.DataRow row in view.Table.Rows)
                {
                    string parentID = (string)row["ParentID"];
                    parentIds.Add(parentID);
                }

                this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, parentIds);
                foreach (System.Data.DataRow row in view.Table.Rows)
                {
                    string parentID = (string)row["ParentID"];
                    if (this.IsDeleteEnabled(parentID))
                    {
                        deleteLimitIds.Add((string)row["ID"]);
                    }
                }

                this.deleteLimitList.Value = JSONSerializerExecute.Serialize(deleteLimitIds);
            }
        }
Esempio n. 4
0
        protected override void OnPreRender(EventArgs e)
        {
            if (TimePointContext.Current.UseCurrentTime && Util.SuperVisiorMode == false)
            {
                this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.ParentOrganization.ID });
            }

            Util.ConfigToggleViewButton(this.views.ActiveViewIndex, this.lnkViewMode, this.lblViewMode);
            base.OnPreRender(e);
        }
        private static PC.Permissions.SCContainerAndPermissionCollection GetPrincipalPermissions(IPrincipal principal, params string[] containerIDs)
        {
            string calculatedKey = CalculatePrincipalAndPermissionKey(principal, containerIDs);

            return((PC.Permissions.SCContainerAndPermissionCollection)ObjectContextCache.Instance.GetOrAddNewValue(calculatedKey, (cache, key) =>
            {
                PC.Permissions.SCContainerAndPermissionCollection permissions = null;
                permissions = AUAclAdapter.Instance.LoadCurrentContainerAndPermissions(GetUserID(principal), containerIDs);

                cache.Add(key, permissions);

                return permissions;
            }));
        }
Esempio n. 6
0
        protected override void OnPreRender(EventArgs e)
        {
            if (TimePointContext.Current.UseCurrentTime && this.IsAdminMode() == false && string.IsNullOrEmpty(this.ParentID) == false)
            {
                this.containerPermissions = AU.Adapters.AUAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.ParentID });
            }

            this.deleteEnabled = TimePointContext.Current.UseCurrentTime && (this.IsAdminMode() || Util.ContainsPermission(containerPermissions, this.ParentID, "DeleteSubUnit"));

            base.OnPreRender(e);
            this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            this.path.DataBind();
            this.hfSchemaID.Value          = this.SchemaID;
            this.hfParentID.Value          = this.ParentID;
            this.scopesRepeater.DataSource = this.Scopes;
            this.scopesRepeater.DataBind();
        }
        protected override void OnPreRender(EventArgs e)
        {
            if (Util.SuperVisiorMode == false)
            {
                this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.appId });
            }

            base.OnPreRender(e);

            roleMatrixEntryControl.AppID           = this.RoleAndAppObject.AppID;
            roleMatrixEntryControl.AppName         = this.RoleAndAppObject.AppName;
            roleMatrixEntryControl.AppCodeName     = this.RoleAndAppObject.AppCodeName;
            roleMatrixEntryControl.RoleID          = this.RoleAndAppObject.RoleID;
            roleMatrixEntryControl.RoleName        = this.RoleAndAppObject.RoleName;
            roleMatrixEntryControl.RoleCodeName    = this.RoleAndAppObject.RoleCodeName;
            roleMatrixEntryControl.RoleDescription = this.RoleAndAppObject.RoleDisplayName;
            roleMatrixEntryControl.Enabled         = this.EditRoleMembersEnabled == false;
        }
Esempio n. 8
0
        protected override void OnPreRender(EventArgs e)
        {
            if (Util.SuperVisiorMode == false)
            {
                this.appId = SCMemberRelationAdapter.Instance.LoadByMemberID(this.RoleAndAppObject.RoleID).Find(m => m.ContainerSchemaType == "Applications" && m.Status == SchemaObjectStatus.Normal).ContainerID;

                this.containerPermissions = SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.appId });
            }

            Util.ConfigToggleViewButton(this.views.ActiveViewIndex, this.lnkViewMode, this.lblViewMode);

            roleMatrixEntryControl.AppID           = this.RoleAndAppObject.AppID;
            roleMatrixEntryControl.AppCodeName     = RoleAndAppObject.AppCodeName;
            roleMatrixEntryControl.AppName         = RoleAndAppObject.AppDisplayName;
            roleMatrixEntryControl.RoleID          = this.RoleAndAppObject.RoleID;
            roleMatrixEntryControl.RoleName        = this.RoleAndAppObject.RoleName;
            roleMatrixEntryControl.RoleCodeName    = this.RoleAndAppObject.RoleCodeName;
            roleMatrixEntryControl.RoleDescription = this.RoleAndAppObject.RoleDisplayName;
            roleMatrixEntryControl.ReadOnly        = EditRoleMembersEnabled == false;

            base.OnPreRender(e);
        }
		protected void dataSourceMain_Selected(object sender, ObjectDataSourceStatusEventArgs e)
		{
			System.Data.DataView view = e.ReturnValue as System.Data.DataView;
			if (view != null)
			{
				HashSet<string> parentIds = new HashSet<string>();
				HashSet<string> deleteLimitIds = new HashSet<string>();
				foreach (System.Data.DataRow row in view.Table.Rows)
				{
					string parentID = (string)row["AppID"];
					parentIds.Add(parentID);
				}

				this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, parentIds);
			}
		}
Esempio n. 10
0
        private static void BindObjectsToTreeNodes(PC.SCObjectAndRelationCollection relations, DeluxeTreeNodeCollection nodes, bool godMode, string[] requiredPermissions, PC.Permissions.SCContainerAndPermissionCollection permissions, string excludeID, string exceptID)
        {
            relations.Sort((m, n) => m.InnerSort.CompareTo(n.InnerSort));
            foreach (PC.SCObjectAndRelation r in relations)
            {
                if (r.ID != excludeID && Util.IsOrganization(r.SchemaType))
                {
                    bool showCheckBoxes;
                    bool selectable;

                    if (r.ID == exceptID)
                    {
                        selectable = false;
                    }
                    else if (godMode)
                    {
                        selectable = true;
                    }
                    else
                    {
                        selectable = true;
                        if (requiredPermissions != null && permissions != null)
                        {
                            foreach (string p in requiredPermissions)
                            {
                                selectable &= Util.ContainsPermission(permissions, r.ID, p);
                            }
                        }
                    }

                    if (HttpContext.Current.Request.QueryString["mode"] == "single")
                    {
                        showCheckBoxes = false;
                    }
                    else
                    {
                        showCheckBoxes = selectable;
                    }

                    DeluxeTreeNode newTreeNode = CreateTreeNode(r.ID, r.Name, r.DisplayName, r.FullPath, selectable, showCheckBoxes);

                    nodes.Add(newTreeNode);
                }
            }
        }
		protected override void OnPreRender(EventArgs e)
		{
			if (Util.SuperVisiorMode == false)
			{
				this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.RoleAndAppObject.AppID });
			}

			Util.ConfigToggleViewButton(this.views.ActiveViewIndex, this.lnkViewMode, this.lblViewMode);
			base.OnPreRender(e);

			roleMatrixEntryControl.AppID = this.RoleAndAppObject.AppID;
			roleMatrixEntryControl.AppCodeName = this.RoleAndAppObject.AppCodeName;
			roleMatrixEntryControl.AppName = this.roleMatrixEntryControl.AppName;
			roleMatrixEntryControl.RoleID = this.RoleAndAppObject.RoleID;
			roleMatrixEntryControl.RoleName = this.RoleAndAppObject.RoleName;
			roleMatrixEntryControl.RoleCodeName = this.RoleAndAppObject.RoleCodeName;
			roleMatrixEntryControl.RoleDescription = this.RoleAndAppObject.RoleDisplayName;
			roleMatrixEntryControl.Enabled = this.EditRoleMembersEnabled == false;
		}
		protected override void OnPreRender(EventArgs e)
		{
			if (TimePointContext.Current.UseCurrentTime && this.IsAdminMode() == false && string.IsNullOrEmpty(this.ParentID) == false)
				this.containerPermissions = AU.Adapters.AUAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.ParentID });

			this.deleteEnabled = TimePointContext.Current.UseCurrentTime && (this.IsAdminMode() || Util.ContainsPermission(containerPermissions, this.ParentID, "DeleteSubUnit"));

			base.OnPreRender(e);
			this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
			this.path.DataBind();
			this.hfSchemaID.Value = this.SchemaID;
			this.hfParentID.Value = this.ParentID;
			this.scopesRepeater.DataSource = this.Scopes;
			this.scopesRepeater.DataBind();
		}
Esempio n. 13
0
 protected override void OnPreRender(EventArgs e)
 {
     this.containerPermissions = SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.GroupParentId });
     base.OnPreRender(e);
 }
		protected override void OnPreRender(EventArgs e)
		{
			if (Util.SuperVisiorMode == false)
			{
				this.appId = SCMemberRelationAdapter.Instance.LoadByMemberID(this.RoleAndAppObject.RoleID).Find(m => m.ContainerSchemaType == "Applications" && m.Status == SchemaObjectStatus.Normal).ContainerID;

				this.containerPermissions = SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.appId });
			}

			Util.ConfigToggleViewButton(this.views.ActiveViewIndex, this.lnkViewMode, this.lblViewMode);

			roleMatrixEntryControl.AppID = this.RoleAndAppObject.AppID;
			roleMatrixEntryControl.AppCodeName = RoleAndAppObject.AppCodeName;
			roleMatrixEntryControl.AppName = RoleAndAppObject.AppDisplayName;
			roleMatrixEntryControl.RoleID = this.RoleAndAppObject.RoleID;
			roleMatrixEntryControl.RoleName = this.RoleAndAppObject.RoleName;
			roleMatrixEntryControl.RoleCodeName = this.RoleAndAppObject.RoleCodeName;
			roleMatrixEntryControl.RoleDescription = this.RoleAndAppObject.RoleDisplayName;
			roleMatrixEntryControl.ReadOnly = EditRoleMembersEnabled == false;

			base.OnPreRender(e);
		}
		protected override void OnPreRender(EventArgs e)
		{
			if (TimePointContext.Current.UseCurrentTime && Util.SuperVisiorMode == false)
				this.containerPermissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.ParentOrganization.ID });

			Util.ConfigToggleViewButton(this.views.ActiveViewIndex, this.lnkViewMode, this.lblViewMode);
			base.OnPreRender(e);
		}
		protected override void OnPreRender(EventArgs e)
		{
			this.containerPermissions = SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, new string[] { this.GroupParentId });
			base.OnPreRender(e);
		}