Hello all!
I am a VB programmer trying to broaden my horizons with javascript. I would like to use the ADsSecurity object that is provided with Windows to see who has what security rights to a given folder or file. Below is the code as I think it should be written in javascript, but I'm not getting results. I'll give more details on the problem in a sec, here's a section of my code embeded in HTML...
Some examples of what might be passed to the function are:
"C:\test.txt", "C:\Program Files\test.txt"
This obviously isn't final code as I'm simply displaying the names of those who have access to the folder passed to this function. When this code is executed, no errors are generated. However, the code is not entering the "for" loop. It's like there are no objAce in objDacl, which there should be. Similer code works in VBScript by using the same objects.
Any thoughts on how I can get this to work?
Thank you!
He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
I am a VB programmer trying to broaden my horizons with javascript. I would like to use the ADsSecurity object that is provided with Windows to see who has what security rights to a given folder or file. Below is the code as I think it should be written in javascript, but I'm not getting results. I'll give more details on the problem in a sec, here's a section of my code embeded in HTML...
Code:
<SCRIPT LANGUAGE="JavaScript1.3">
function displaySecurity(strPath){
var objSec = new ActiveXObject("ADsSecurity")
var objSD
var objDacl
objSD = objSec.GetSecurityDescriptor("FILE://" + strPath)
objDacl = objSD.DiscretionaryAcl
for(objAce in objDacl){
alert(objAce.Trustee)
}
}
</SCRIPT>
"C:\test.txt", "C:\Program Files\test.txt"
This obviously isn't final code as I'm simply displaying the names of those who have access to the folder passed to this function. When this code is executed, no errors are generated. However, the code is not entering the "for" loop. It's like there are no objAce in objDacl, which there should be. Similer code works in VBScript by using the same objects.
Any thoughts on how I can get this to work?
Thank you!
He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon