Beispiel #1
0
        private static void LoadRoleDefinition(TreeNode parentNode, MainBrowser form, SPClient.RoleDefinition roleDefinition)
        {
            TreeNode node = parentNode.Nodes.Add(string.Format("{0}", roleDefinition.Name));

            node.ImageKey         = Constants.IMAGE_ROLE_DEFINITIONS;
            node.SelectedImageKey = Constants.IMAGE_ROLE_DEFINITIONS;
            node.Tag = roleDefinition;
            node.ContextMenuStrip = form.mnContextItem;

            string[] keys = Enum.GetNames(typeof(SPClient.PermissionKind));
            foreach (string key in keys.OrderBy(k => k))
            {
                if (roleDefinition.BasePermissions.Has((SPClient.PermissionKind)Enum.Parse(typeof(SPClient.PermissionKind), key)))
                {
                    SPClient.PermissionKind permission = (SPClient.PermissionKind)Enum.Parse(typeof(SPClient.PermissionKind), key, true);

                    TreeNode sNode = node.Nodes.Add(string.Format("{0} ({1})", permission.ToString(), (int)permission));
                    sNode.ImageKey         = Constants.IMAGE_ROLE_DEFINITIONS;
                    sNode.SelectedImageKey = Constants.IMAGE_ROLE_DEFINITIONS;
                    sNode.Tag = permission;
                }
            }
        }
Beispiel #2
0
        //public static string GetUrl(this SPClient.File file)
        //{
        //    return null;
        //}

        public static string GetSettingsUrl(this SPClient.RoleDefinition role)
        {
            // [sitecollection|web]/_layouts/15/editrole.aspx?role=Full%20Control

            return(string.Format("{0}/_layouts/15/editrole.aspx?role={1}", role.Context.Url, role.Name));
        }