Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  List Security Settings
 
  chubbard posted this script:
  webcall function listSecuritySettings()
{
//output a table listing each folder
//in the web and its security settings.
<ws:tags><html><head></head><body>
    <table width = "100%" border=1>
        <tr>
            <td><b>Folder</b></td>
            <td><b>Anonymous</b></td>
            <td><b>Members</b></td>
            <td><b>Guests</b></td>
            <td><b>Staff</b></td>
        </tr>
</ws:tags>;

//call recursive function to retrieve
//folder security settings.
getSecuritySettings("/");

<ws:tags></table></body></html></ws:tags>;
}

private function getSecuritySettings(szParent)
{
if(Folder.exists(szParent))
    {
    //break folder path into parts.
    var aPart = szParent.split("/");
    //get Folder object.
    var fParent = Folder.getExisting(szParent);
    //get subfolders of Folder object.
    var aChild = fParent.Folders.getObjects();
   
    //list security settings for each subfolder.
    for(var i = 0; i < aChild.length; i++)
        {
        <ws:tags><tr><td></ws:tags>;
        //start with first element of array after root.
        for(var j = 1; j < aPart.length - 1; j++)
            //write spaces for subfolders.
            response.write("   ");
           
        <ws:tags>
            - <%=aChild[i].name;%></td>
            <td><%=getRoleString(aChild[i].getRole("Anonymous"));%></td>
            <td><%=getRoleString(aChild[i].getRole("Members"));%></td>
            <td><%=getRoleString(aChild[i].getRole("Guests"));%></td>
            <td><%=getRoleString(aChild[i].getRole("Staff"));%></td>
            </tr>
        </ws:tags>;

        //call function on this subfolder.
        getSecuritySettings(aChild[i].path);
        }
    }
}


private function getRoleString(nRole)
{
switch(nRole)
    {
    case Folder.Role_Owner:
        return "Owner";
        break;
    case Folder.Role_Administrator:
        return "Administrator";
        break;
    case Folder.Role_Manager:
        return "Manager";
        break;
    case Folder.Role_Designer:
        return "Designer";
        break;
    case Folder.Role_Editor:
        return "Editor";
        break;
    case Folder.Role_Author:
        return "Author";
        break;
    case Folder.Role_Depositor:
        return "Depositor";
        break;
    case Folder.Role_Reader:
        return "Reader";
        break;
    case Folder.Role_Author:
        return "Author";
        break;
    case Folder.Role_DataReader:
        return "DataReader";
        break;
    case Folder.Role_NoAccess:
        return "NoAccess";
        break;
    default:
        break;   
    }
}
 
  on 2001-03-22 19:13:30, chubbard responded:
  What does this script do? It sure looks cool.  
  on 2001-03-22 19:21:05, chubbard responded:
  This script prints out a table listing the security settings for the Staff, Members, Guests, and Anonymous groups for each folder in your web. It's a quick way to see all of the important security settings for your web, without clicking through each folder.

To try it, paste the script into a Westside Script file (.ws file), save, and click the Test button.

The Westside script library is awesome!
 
  on 2001-04-06 17:04:39, chubbard responded:
  Indeed this is cool. Just added a few enhancements: display the root folder, indentation.

// each subfolder level indents by this many pixels
var nPixelsIndent = 16;

webcall function listSecuritySettings()
{
//output a table listing each folder
//in the web and its security settings.
<ws:tags><html><head></head><body>
    <table width = "100%" border=1>
        <tr>
            <td><b>Folder</b></td>
            <td><b>Anonymous</b></td>
            <td><b>Members</b></td>
            <td><b>Guests</b></td>
            <td><b>Staff</b></td>
        </tr>
</ws:tags>;

//call recursive function to retrieve
//folder security settings.
getSecuritySettings("/");

<ws:tags></table></body></html></ws:tags>;
}

private function OutputSettings(folder, nIndent)
{
// use inline style 'padding-left' to indent each folder name
<ws:tags>
    <tr>
    <td style='padding-left:<%=nIndent ? nIndent * nPixelsIndent : nPixelsIndent%>;'>
    <%="/" + folder.name%></td>
    <td><%=getRoleString(folder.getRole("Anonymous"));%></td>
    <td><%=getRoleString(folder.getRole("Members"));%></td>
    <td><%=getRoleString(folder.getRole("Guests"));%></td>
    <td><%=getRoleString(folder.getRole("Staff"));%></td>
    </tr>
</ws:tags>;
}

private function getSecuritySettings(szParent)
{
if(Folder.exists(szParent))
    {
    //break folder path into parts.
    var aPart = szParent.split("/");
    //get Folder object.
    var fParent = Folder.getExisting(szParent);
    //get subfolders of Folder object.
    var aChild = fParent.Folders.getObjects();

    OutputSettings(fParent, aPart.length - 2);

    //list security settings for each subfolder.
    for(var i = 0; i < aChild.length; i++)
        {
        //call function on this subfolder.
        getSecuritySettings(aChild[i].path);
        }
    }
}


private function getRoleString(nRole)
{
switch(nRole)
    {
    case Folder.Role_Owner:
        return "Owner";
        break;
    case Folder.Role_Administrator:
        return "Administrator";
        break;
    case Folder.Role_Manager:
        return "Manager";
        break;
    case Folder.Role_Designer:
        return "Designer";
        break;
    case Folder.Role_Editor:
        return "Editor";
        break;
    case Folder.Role_Author:
        return "Author";
        break;
    case Folder.Role_Depositor:
        return "Depositor";
        break;
    case Folder.Role_Reader:
        return "Reader";
        break;
    case Folder.Role_Author:
        return "Author";
        break;
    case Folder.Role_DataReader:
        return "DataReader";
        break;
    case Folder.Role_NoAccess:
        return "NoAccess";
        break;
    default:
        break;   
    }
}
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us