The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ASP Programming
|
Permissions
Discuss Permissions in the ASP Programming forum on Dev Shed. Permissions ASP Programming forum discussing Active Server Pages coding techniques and problem solving methods. Use VBScript or Jscript to make dynamic web applications.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 18th, 2012, 09:24 AM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 10
Time spent in forums: 2 h 29 m 31 sec
Reputation Power: 0
|
|
|
Permissions
Hello everyone, i've been doing quite a bit of reading over the past week and cannot seem to find a remedy for my script. What i'm looking to do is add a user to an active directory group leveraging an existing classic asp page. I currently have an ID and pw with the proper credentials and am looking for an alternative to giving all who access the page admin rights.
My script fails giving me the error `80072020` on the line:
Set objGroup = GetObject("LDAP://CN=MOI-USERS-GS,OU=Applications,OU=Groups,DC=corporate,DC=corp,DC=com")
Is it possible for me to establish credentials for this operation that would allow it to be carried out and how?
here are the relevant pieces of the script in question:
asp Code:
Original
- asp Code |
|
|
|
<% Dim result, personFor, personBy personFor = "Samuel J Link" personBy = "Samuel J Link" result = getDN(personFor) 'Main If isMember("MOI-USERS-GS")=1 Then response.write("Is member") Else response.write("Is not a member") Set objGroup = GetObject("LDAP://CN=MOI-USERS-GS,OU=Applications,OU=Groups,DC=corporate,DC=corp,DC=com") Set objUser = GetObject("LDAP://" & result) objGroup.add(objUser.ADspath) End If 'Is member Function IsMember(groupName) If IsEmpty(groupListD) then Set groupListD = CreateObject("Scripting.Dictionary") groupListD.CompareMode = 1 dim result result = "Uid" ADpath = "Corporate" & "/" & result Set userPath = GetObject("WinNT://" & ADpath & ",user") For Each listGroup in userPath.Groups groupListD.Add listGroup.Name, "-" Next End if IsMember = CBool(groupListD.Exists(groupName)) End Function 'get personFor DN Function getDN(name) Dim adoCommand, adoConnection, strBase, strFilter, strAttributes Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strsAM, objUser Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" With adoConnection .Properties("User ID") = "PID" 'This is where the Process ID goes .Properties("Password") = "PW" 'password .Properties("encrypt password") = True End With adoConnection.Open "Active Directory Provider" Set adoCommand = CreateObject("ADODB.Command") Set adoCommand.ActiveConnection = adoConnection Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("defaultNamingContext") adoCommand.CommandText = "<LDAP://corporate.amfam.com>;(&(objectCategory=user)(CN=" & name & "));distinguishedName;subtree" adoCommand.Properties("Page Size") = 100 adoCommand.Properties("Timeout") = 30 adoCommand.Properties("Cache Results") = False Set adoRecordset = adoCommand.Execute strsAM = adoRecordset.Fields("distinguishedName").Value getDN= strsAM adoRecordset.Close adoConnection.Close End Function %>
thank you everyone for your assistance and time.
|

June 18th, 2012, 03:22 PM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 10
Time spent in forums: 2 h 29 m 31 sec
Reputation Power: 0
|
|
|
got it
Hey everyone, got the above code to work by using the:
asp Code:
Original
- asp Code |
|
|
|
Dim oGroup: Set oGroup = oDSObj.OpenDSObject
now i'm attempting to append information to a csv but cant seem to get the file path specified correctly. does there appear to be anything wrong with this path? or is it just another permissions issue?? x_x
asp Code:
Original
- asp Code |
|
|
|
'output To CSV Log sub outputToCSV (arg0, arg1, arg2) Const ForAppending = 8 'change log to final destination strFileOutput = "http://seconsec/seconsec/dev/sam/logs.csv" Set objFSO = server.CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strFileOutput) Then Set objOutputFile = objFSO.OpenTextFile (strFileOutput, 8) Else Set objOutputFile = objFSO.CreateTextFile(strFileOutput) objOutputFile.Writeline "Date:" & "," & "Requested for:" & "," & "Requested By:" & "," & "Status of Request:" End If If Err <> 0 Then Wscript.Echo "Unable to open " & strFileOutput & " for output." WScript.Quit End If objOutputFile.Writeline Date() & "," & arg0 & "," & arg1 & "," & arg2 End sub
|

June 18th, 2012, 05:28 PM
|
|
|
|
Thank you for updating the topic with your solution.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|