Exemplo n.º 1
0
        public static void getUserGroupsForSite(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url)
        {
            if (url == string.Empty) return;

            string groups = null;
            string roles = String.Empty;
            string groupName = String.Empty;

            LMD.ListCheck.WS_usergroup.UserGroup myservice = new LMD.ListCheck.WS_usergroup.UserGroup();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/usergroup.asmx";

            try
            {

                System.Xml.XmlNode nodes = myservice.GetGroupCollectionFromWeb();

                sw.WriteLine("");
                sw.WriteLine("");
                sw.WriteLine("Url: " + url);

                sw.WriteLine("  Site Permissions");

                foreach (System.Xml.XmlNode node in nodes)
                {
                    if (node.Name == "Groups")
                    {

                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            groupName = node.ChildNodes[i].Attributes["Name"].Value;
                            roles = String.Empty;

                            System.Xml.XmlNode nodes2 = myservice.GetRoleCollectionFromGroup(groupName);
                            foreach (System.Xml.XmlNode node2 in nodes2)
                            {
                                if (node2.Name == "Roles")
                                {
                                    for (int k = 0; k < node2.ChildNodes.Count; k++)
                                    {
                                        if (roles != String.Empty)
                                            roles += ", ";
                                        roles += node2.ChildNodes[k].Attributes["Name"].Value;
                                    }
                                }
                            }

                            sw.WriteLine("    Group: " + groupName + ", Roles: " + roles);

                        }
                    }

                }

                enumerateListPermissions(sw, wssAuthentication, url);

            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
Exemplo n.º 2
0
        public static void getPermissionLevels(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url)
        {
            Dictionary<string, string> sc = new Dictionary<string, string>();

            if (url == string.Empty) return;

            LMD.ListCheck.WS_usergroup.UserGroup myservice = new LMD.ListCheck.WS_usergroup.UserGroup();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/usergroup.asmx";

            try
            {

                System.Xml.XmlNode nodes = myservice.GetRolesAndPermissionsForSite();

                sw.WriteLine("Url: " + url);

                sw.WriteLine("  Site Permissions");

                foreach (System.Xml.XmlNode node in nodes)
                {
                    if (node.Name == "Role")
                    {
                        sc.Add(node.Attributes["Name"].Value, node.Attributes["BasePermissions"].Value);
                    }

                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }