Access Control"

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

Line 1: Line 1:
 
__TOC__
 
__TOC__
  
Access control is a way you to give your users different permissions while working on folders and files. The default setting in the config.php file gives permission to every user and permits all the options. In order to change this configuration you must firstly know the basic of the '''accessControl(0)''' function placed in the config.asp file. 
+
Access control is a way you to give your users different permissions while working on folders and files. The default setting in the config.asp file gives permission to every user and permits all the options. In order to change this configuration you must firstly know the basic of the '''accessControl(0)''' function placed in the config.asp file. 
  
 
The syntax of the function:
 
The syntax of the function:
 
<pre>Set accessControl(0) = DefineAccessControlItem("*", "*", "/", true, true, true, true, true, true, true, true)</pre>  
 
<pre>Set accessControl(0) = DefineAccessControlItem("*", "*", "/", true, true, true, true, true, true, true, true)</pre>  
 
Functions are definied in the following order:
 
Functions are definied in the following order:
<pre>Function DefineAccessControlItem(role, resourceType, folder, folderView, folderCreate, folderRename, folderDelete, fileView, fileUpload, fileRename, fileDelete)</pre>  
+
<pre>Function DefineAccessControlItem( _ role, resourceType, folder, _ folderView, folderCreate, folderRename, folderDelete, _ fileView, fileUpload, fileRename, fileDelete )</pre>  
 
The three most important parameters of the "'''Access Control'''" function are:
 
The three most important parameters of the "'''Access Control'''" function are:
  
Line 27: Line 27:
 
The above example only refers to file operations in the folder "/Logos" itself. It doesn't restrict operations on the folder so the user can delete or rename the folder. In order to limit users ability to modify the folder (not its context) you should change permissions in the parent folder.<br>Example:
 
The above example only refers to file operations in the folder "/Logos" itself. It doesn't restrict operations on the folder so the user can delete or rename the folder. In order to limit users ability to modify the folder (not its context) you should change permissions in the parent folder.<br>Example:
 
<pre>Set accessControl(1) = DefineAccessControlItem("*", "Images", "/", true, true, false, false, true, false, false, false)</pre>  
 
<pre>Set accessControl(1) = DefineAccessControlItem("*", "Images", "/", true, true, false, false, true, false, false, false)</pre>  
Now a user can view and create a folder, but he will be unable to rename or delete it. This is the best way to secure your folders from unauthorized access. '''Note''':Please, remember to adjust Dim accessControl(0) to Dim accessControl(1).
+
Now a user can view and create a folder, but he will be unable to rename or delete it. This is the best way to secure your folders from unauthorized access. '''Note''':Please, remember to adjust Dim accessControl(0) to Dim accessControl(1) as necessary.
  
 
=== sessions ===
 
=== sessions ===

Revision as of 00:10, 11 January 2008

Access control is a way you to give your users different permissions while working on folders and files. The default setting in the config.asp file gives permission to every user and permits all the options. In order to change this configuration you must firstly know the basic of the accessControl(0) function placed in the config.asp file. 

The syntax of the function:

Set accessControl(0) = DefineAccessControlItem("*", "*", "/", true, true, true, true, true, true, true, true)

Functions are definied in the following order:

Function DefineAccessControlItem( _ role, resourceType, folder, _ folderView, folderCreate, folderRename, folderDelete, _ fileView, fileUpload, fileRename, fileDelete )

The three most important parameters of the "Access Control" function are:

role

The roleis an attribute which sets the type of the user. It is set to "*" as default and you may treat as 'every user'. You may set this parameter to other name like: 'user' or 'limited_functions'. The name of the user type will be directly connected to the function the user may use.

resourceType

The resourceType defines the resources handled in CKFinder. A resource type is nothing more than a way to group files under different paths, each one having different configuration settings. E.g. Images, Flash, Files.It is set to "*" as default and means that all of the resources are available.

folder

Folder determines where your limitations will be used. By placing the folders name you specify the place you want to put your restrictions in. It is set to "/" as default so no folder is set.

folder and file options

The rest of the variables are bool type and can be set as true or false. True of course enables an option, false disables it.
Example:
If you want to restrict the upload, rename or delete of files in the "Logos" folder of the resource type "Images":

Set accessControl(1) = DefineAccessControlItem("*", "Images", "/Logos", true, true, true, true, true, false, false, false)

The above example only refers to file operations in the folder "/Logos" itself. It doesn't restrict operations on the folder so the user can delete or rename the folder. In order to limit users ability to modify the folder (not its context) you should change permissions in the parent folder.
Example:

Set accessControl(1) = DefineAccessControlItem("*", "Images", "/", true, true, false, false, true, false, false, false)

Now a user can view and create a folder, but he will be unable to rename or delete it. This is the best way to secure your folders from unauthorized access. Note:Please, remember to adjust Dim accessControl(0) to Dim accessControl(1) as necessary.

sessions

In order to enable the access control options for different users you should initialize a session.

CKFinder_Config.Add "RoleSessionVar", "CKFinder_UserRole"

The session is a mechanism which will allow you to give different permissions to different users.
Example:
In your config.asp file you create three different roles:

First role admin (*):

Set accessControl(1) = DefineAccessControlItem("*", "*", "/", false, false, false, false, false, false, false, false)

Second role user:

Set accessControl(2) = DefineAccessControlItem("user", "*", "/", true, true, false, false, true, true, false, false)

Third role guest:

Set accessControl(3) = DefineAccessControlItem("guest", "*", "/", true, false, false, false, true, false, false, false)

You've created three different users permissions.

Important: Note that when the role is set to * the user always has administrative privileges even though all the options are set to false.

Now you must create a place where you will point out the role you want to use e.g. a file. In this file you put initialize the session and write the command which will access you pre-defined role:

<%
Session("CKFinder_UserRole")="user"
%>