Re: WSS: Finding My Sites through SQL



On 9 Aug., 09:31, drkaj <kbonf...@xxxxxxxxx> wrote:
Hi everybody,

I need to find all sites that a use has access to, and present these
sites on a diferent server than the WSS server. I have tried to do
this using the web-services, but the performance is rather poor. My
strategy was to find all sites on the server, and then try to get the
list collection for each site. If the user can get the list
connection, he must have access.. Any better way?

static void Main(string[] args)
{

WebsService.Webs ws = new ConsoleApplication1.WebsService.Webs();
ws.Credentials = new NetworkCredential("foo", "bar", "goo");
XmlNodeList AllSites =
ws.GetAllSubWebCollection().SelectNodes("*");

ListsServices.Lists listService = new
ConsoleApplication1.ListsServices.Lists();
listService.Credentials = CredentialCache.DefaultCredentials;
foreach (XmlNode node in AllSites)
{
if (UserHasAccess(node.Attributes["Url"].Value, listService))
{
Console.WriteLine(node.Attributes["Url"].Value + "\t" +
node.Attributes["Title"].Value);
}
}
listService.Dispose();
ws.Dispose();
Console.ReadLine();
}

private static bool UserHasAccess(string url, ListsServices.Lists
list)
{
bool result = false;
string wsUrl = url + "/_vti_bin/lists.asmx";

try
{
list.Url = wsUrl;
XmlNode node = list.GetListCollection();
result = true;
}
catch (Exception ex) { }
return result;
}

I know that MS doesn't recommend using direct DB access, but in this
case the performance is too slow. I tried to figure out how the db
works, and I came up with this SQL:

declare @userId as int
Select @userId = tp_ID from UserInfo where tp_login like 'DOMAIN
\username'

select 'http://wssserver/'+ fullUrl from webs
where id in (
select wgms.WebId from webGroupMembership wgms
join WebGroups wg on
wg.Id = wgms.GroupId
and wg.WebId = wgms.WebId
where MemberId = @UserId
and wg.Type >2

union

select WebId from webMembers
where userId = @userId
)

order by fullUrl

Can anybody verify this sql?

I know that both the C# code and the SQL looks like !"#%!#¤"... But
its just quick prototyping to test the functionality...

Any other sugestions for solving the problem?

Regards, Kaj

Btw... Its WSS 2.0 i'm dealing with.. (I know it sucks but i cant
convince my customer to upgrade :-( )

.



Relevant Pages

  • WSS: Finding My Sites through SQL
    ... sites on a diferent server than the WSS server. ... foreach (XmlNode node in AllSites) ... and I came up with this SQL: ... Select @userId = tp_ID from UserInfo where tp_login like 'DOMAIN ...
    (microsoft.public.sharepoint.windowsservices)
  • Domain Name of user
    ... Using VFP 9.2 on Windows 2000 or XP workstations. ... Back end is MS SQL 2000. ... Some users are on the same domain as the server and so I allow them access ... syswhich returns the machine name and userid. ...
    (microsoft.public.fox.programmer.exchange)
  • RE: Fulltext failure on a 2 node cluster
    ... Server full-text search resource online: "SQL Cluster Resource 'Full Text' ...
    (microsoft.public.sqlserver.clustering)
  • Re: HELP PLEASE ~ ???
    ... You mentioned that it went ahead and added a SQL ... SQL Server 2000 database for all my data. ... find the connectionString in the newly recreated SQLExpress database. ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multi-Channel Raid VS SAN Storage
    ... A 5~6 years old server is a very old server. ... As I mentioned, the server is one node in a cluster environment, and SQL is ... We actually are running RAID 1+0 and our aplication is definately more ... needs it's own SAN device, or at least a dedicated IO channel on the SAN. ...
    (microsoft.public.sqlserver.setup)