We have a bespoke c# web app that stores extra information about a physical folder structure. Every folder or file in the company share has a record in sql. We use the web app to search these records. I want to store active directory permissions of the physical paths against the sql records.
What is the preferred method of querying AD in c# (.net 3.5)?
Do I store the friendly group/user name or the SID?
Is the SID unique?
Does the SID change if a user moves to another location (differnet OU)?
The idea is that the query can look like this...
SELECT CompanyDoc.Name, CompanyDoc.Path
FROM CompanyDoc
INNER JOIN Permission ON CompanyDoc.ID = Permissions.CompanyDocID
WHERE CompanyDoc.MetaData = @serach param
AND Permission.SID IN ( @userSidList )
GROUP BY CompanyDoc.Name, CompanyDoc.Path