Exemple #1
0
        private void displayRoles(SushiSecurable sec, string indentSpaces)
        {
            foreach (UorG uorG in sec.UorGs)
            {
                AddToRtbLocal(indentSpaces + uorG.Name, uorG.IsADgroup ? StyleType.bodyMidnightBlue : StyleType.bodyBlack);
                foreach (string role in uorG.RoleNames)
                {
                    AddToRtbLocal(" [" + role + "]", StyleType.bodyBlack);
                }

                AddToRtbLocal("\r\n", StyleType.bodyBlack);
            }
        }
Exemple #2
0
        private void displayIt(SushiSecurable secSite)
        {
            if (!secSite.AtLeastOnePermission)
            {
                return;
            }

            AddToRtbLocal("\r\n" + secSite.Name, StyleType.bodyBlueBold);
            string s = chkShowLinkToManagePermissions.Checked ? secSite.HyperLinkSiteSecurity + "\r\n" : "\r\n";

            SmartStepUtil.AddToRTB(rtbDisplay, " " + s, Color.DarkGray, 4, false);
            displayRoles(secSite, "   ");
            foreach (SushiSecurable secList in secSite.SecurableLists)
            {
                AddToRtbLocal("   " + secList.Name, StyleType.bodySeaGreen);
                SmartStepUtil.AddToRTB(rtbDisplay, " (" + secList.ListType + ")", Color.SeaGreen, 8, false);
                string s2 = chkShowLinkToManagePermissions.Checked ? secList.HyperLinkSiteSecurity + "\r\n" : "\r\n";
                SmartStepUtil.AddToRTB(rtbDisplay, " " + s2, Color.DarkGray, 5, false);
                displayRoles(secList, "      ");
            }
            SmartStepUtil.ScrollToBottom(rtbDisplay);
        }
Exemple #3
0
        private SushiSecurable findRoleAssignmentsForMember(SPSecurableObject webOrList, SPUser user, List <string> userSharepointGroups, List <string> userADgroups)
        {
            SushiSecurable secSiteOrList = new SushiSecurable();

            if (!webOrList.HasUniqueRoleAssignments && !chkShowOnlyUnique.Checked)
            {
                return(secSiteOrList);
            }

            foreach (SPRoleAssignment ra in webOrList.RoleAssignments)
            {
                string raName = ra.Member.Name.ToUpper();
                if (raName == user.Name.ToUpper() || userSharepointGroups.Contains(raName) || userADgroups.Contains(raName))
                {
                    UorG uOrG = new UorG(ra.Member.Name, userADgroups.Contains(raName));
                    if (ra.Member.Name.ToUpper() == user.Name.ToUpper())
                    {
                        uOrG.Name = user.LoginName;
                    }
                    secSiteOrList.UorGs.Add(uOrG);
                    foreach (SPRoleDefinition rd in ra.RoleDefinitionBindings)
                    {
                        uOrG.RoleNames.Add(rd.Name);
                    }
                    secSiteOrList.AtLeastOnePermission = true;
                }
            }
            if (user.IsSiteAdmin)
            {
                UorG uOrG = new UorG("Site Collection Admins", false);
                secSiteOrList.UorGs.Add(uOrG);
                uOrG.RoleNames.Add("Full Control");
                secSiteOrList.AtLeastOnePermission = true;
            }
            return(secSiteOrList);
        }
Exemple #4
0
        private void findRoleAssignments(SPWeb web1, SPUser user, int depth, List <string> userSharepointGroups, List <string> userADgroups)
        {
            SushiSecurable secSite = findRoleAssignmentsForMember(web1, user, userSharepointGroups, userADgroups);

            secSite.Name = web1.ServerRelativeUrl;
            secSite.HyperLinkSiteSecurity = web1.Url + "/_layouts/user.aspx";

            foreach (SPList spList in web1.Lists)
            {
                SushiSecurable secList = findRoleAssignmentsForMember(spList, user, userSharepointGroups, userADgroups);
                if (secList.AtLeastOnePermission)
                {
                    if (spList.Hidden)
                    {
                        continue;
                    }
                    secList.Name                 = spList.Title;
                    secList.ListType             = spList.GetType().Name;
                    secSite.AtLeastOnePermission = true;
                    secSite.SecurableLists.Add(secList);
                    secList.HyperLinkSiteSecurity = spList.ParentWeb.Url + "/_layouts/user.aspx?List=" + spList.ID.ToString() + "";
                }
            }

            //--
            displayIt(secSite);
            SmartStepUtil.ScrollToBottom(rtbDisplay);
            Application.DoEvents();

            //--recursively loop through all subwebs of top level site.
            foreach (SPWeb web2 in web1.Webs)
            {
                findRoleAssignments(web2, user, depth++, userSharepointGroups, userADgroups);
                web2.Dispose();
            }
        }