Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Louise Newell 17 posts 67 karma points
    Dec 02, 2013 @ 15:24
    Louise Newell
    0

    User Permissions in custom section

    I would like to have the User permissions from the User section in a custom section, so I can grant access to this separate from other functions like User types. This would prevent a user being able to create a new user type with higher permissions and then setting themselves to that type.

    I am using umbraco 6.1.2 with MVC.

    I have created the custom section fine, with the user permssions in it. The problem is when you click on a user name the the inner content does not appear. The right frame is showing dashboard.aspx rather than PermissionEditor.aspx.

    However if I then open the Users section and then go back into the custom section it then works OK. I believe the Users section is doing some sort of authorisation which is triggering the custom section to work.

    What and where do I need to add to the custom section to make it do this authorisation? Or is it something else?

    Tree:

    [Tree("ekstras", "copyTree", "User permmssions")]

        public class CopyTree : umbraco.cms.presentation.Trees.BaseTree

        {

            public CopyTree(string application)

                : base(application)

            {

            }

     

            protected override void CreateRootNode(ref XmlTreeNode rootNode)

            {

                rootNode.NodeType = "copy";

                rootNode.NodeID = "init";

                rootNode.Menu = new List<IAction> { ActionRefresh.Instance };

            }

     

            public override void Render(ref XmlTree tree)

            {

                foreach (var person in EKStras.Models.EKStrasUserData.GetUserList())

                {

                    var node = XmlTreeNode.Create(this);

                    node.NodeID = person.UserID.ToString();

                    node.NodeType = "userPermissions";

                    node.Text = person.UserLogin;

                    node.Action = string.Format("javascript:openUserPermissions({0});", person.UserID.ToString());

                    node.Icon = "user.gif";

                    node.OpenIcon = "user.gif";

                    node.HasChildren = false;

                    node.Menu = new List<IAction>();

                    OnBeforeNodeRender(ref tree, ref node, EventArgs.Empty);

                    if (node != null)

                    {

                        tree.Add(node);

                        OnAfterNodeRender(ref tree, ref node, EventArgs.Empty);

                    }

                }

            }

     

            public override void RenderJS(ref System.Text.StringBuilder Javascript)

            {

                Javascript.Append(@"function appItemSingleClick(itemName) {UmbClientMgr.historyManager().addHistory(itemName);return false;}");

                Javascript.Append(@"function appItemDoubleClick(itemName) {UmbClientMgr.mainTree().clearTreeCache();UmbClientMgr.historyManager().addHistory(itemName);return false;}");

                Javascript.Append(@"function appClick(appItem) {var that = this; setTimeout(function () {var dblclick = parseInt($(that).data('double'), 10);if (dblclick > 0) {$(that).data('double', dblclick - 1);}else {appItemSingleClick.call(that, appItem);}}, 300);return false;}");

                Javascript.Append(@"function appDblClick(appItem) {$(this).data('double', 2);appItemDoubleClick.call(this, appItem);return false;}");

            }

        }

     

Please Sign in or register to post replies

Write your reply to:

Draft