Hi,
I'm trying to use ckfinder as a file repository. I have some user, and I want them to access their own folder, and only this one.
So in my basedir, I have 2 folder :
- Folder1
- Folder2
And I have 2 users : user1 and user2. I want user1 to access only folder1 and user2 to access only folder2.
I don't need any filtetype implementation (see my feature request), so I imagined 2 way of achieving this :
- one ressourceType "All" accepting all types of files
- two AccessControl depending of the user role, to restrict access to one folder
or
- two ressourceType : "folder1" and "folder2" accepting all type of files
- two AccessControl : depending of the user role, to restrict access to one folder
I succeeded yesterday to make work the second solution, but it doesn't work anymore today
And I didn't succeed at all to make the first solution work.
Could you indicate me which would be the best solution to make it work, and how I should write my configuration file ?
Thanks a lot.
Tue, 01/06/2009 - 16:01
#1
Re: How to have one and only one folder per user ?
In config.php add at the beginning
to have access to variables stored in the $_SESSION array.
Suppose that when user logs in, the following variables are set:
We can now create two access controls.
Deny access by default to unauthenticated users:
Allow everything for "users" group members:
Now we still have to allow user1 to control only folder1 and user2 to control only his own folder. We will achieve this by creating a dynamic resource type definition:
Note that the url/directory where CKFinder saves files depends on the session variable.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: How to have one and only one folder per user ?
Thank you very much for this answer, which seems to be exactly what I need. But I was trying to make it work, when I get a javscript alert about an error :
"URL requested: "http://www.studiokalafunga.com/ckfinder/core/connector/php/connector.php?command=Init"
Server response:
Status: 200
Response text:
<?xml version="1.0" encoding="utf-8"?><br />
<b>Fatal error</b>: Call to a member function getUrl() on a non-object in <b>D:\www\studiokalafunga.com\htdocs\ckfinder\core\connector\php\php5\CommandHandler\Init.php</b> on line <b>123</b><br />"
I try to revert what I did in the config file, but the error remains... Do you think it could be related to the fact I have another function called getUrl somewhere else in my code, which is not a class function ?
Thanks.
Re: How to have one and only one folder per user ?
Alternatively, could you please send me a PM with your configuration file?
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: How to have one and only one folder per user ?
Re: How to have one and only one folder per user ?
At the beginning of config file add:
to initialize $_SESSION variables.
In:
change role to 'users' to grant ACL access to users that belong to group "users".
And the last thing, it turned out that CKFinder needs at least one resource type definition to work, so the following code could be used instead:
(if user is not authenticated, he will be redirected to 'unathenticated' folder in which he won't be allowed to perform any operation).
Remember that when using the configuration settings above, the two variables: $_SESSION['CKFinder_UserFolder'], $_SESSION['CKFinder_UserRole'] should be set after user logs in so that CKFinder could use them.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: How to have one and only one folder per user ?