Пример #1
0
        private void ProcessWebSite(SPWeb web)
        {
            SquadronContext.WriteDebugMessage("Entering ProcessWebSite() " + _utility.GetDisplayName(web, true));

            try
            {
                if (IsFilterDiscard(web.Url))
                {
                    return;
                }

                if (UniquePermissionsCheck.Checked)
                {
                    if (!web.HasUniqueRoleAssignments)
                    {
                        _discardedCount++;
                        return;
                    }
                }

                string permissionType = GetPermissionType(web);
                Result.Add(
                    new PermissionInfo()
                {
                    Type           = "Site",
                    Title          = web.Title,
                    Url            = web.Url,
                    PermissionType = permissionType,
                    InternalObject = web,
                    InheritUrl     = GetInheritedUrl(web)
                });

                if (permissionType.StartsWith("Inherit"))
                {
                    if (!ExpandInheritedCheck.Checked)
                    {
                        return;
                    }
                }

                string roleAssignment = string.Empty;

                int count = 0;

                foreach (SPRoleAssignment rolea in web.RoleAssignments)
                {
                    roleAssignment = rolea.Member.ToString();

                    string permissionLevels = string.Empty;
                    foreach (SPRoleDefinition roledef in rolea.RoleDefinitionBindings)
                    {
                        permissionLevels += roledef.Name + "; ";
                    }

                    Result.Add(
                        new PermissionInfo()
                    {
                        RoleAssignments  = roleAssignment,
                        RoleType         = GetRoleType(rolea.Member),
                        Owner            = GetOwner(rolea.Member),
                        PermissionLevels = permissionLevels,
                        UsersInGroup     = GetUsersInGroup(roleAssignment, web),
                        InternalObject   = web
                    }
                        );
                    count++;
                }

                if (count == 0)
                {
                    Result.Add(new PermissionInfo()
                    {
                        RoleAssignments = "(no assignments)"
                    });
                }
            }
            catch (Exception ex)
            {
                SquadronContext.HandleException(new ObjectException(web, ex));
                _errorsOccurred = true;
            }
        }
Пример #2
0
 public override string ToString()
 {
     return(_utility.GetDisplayName(InternalObject));
 }