What would be the best way to use CKFinder with one base directory per user in the PHP version ?
I found how to dynamically set the Base directory per user with session variables, but I would need the ACLs to come from my database instead of the config file.
My database defines permissions per user, they would have to replace the ones coming from the config file.
Thank you for your time.
I found how to dynamically set the Base directory per user with session variables, but I would need the ACLs to come from my database instead of the config file.
My database defines permissions per user, they would have to replace the ones coming from the config file.
Thank you for your time.
Re: Dynamic base directories and ACL
Config file is executed on each request by PHP connector.
So you can use in config.php something like that for example:
Note that if user X is logged in, you don't have to add to $config['AccessControl'] ACL settings for all other users.
Of course you don't need to load permissions from DB every time, you can cache them.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Dynamic base directories and ACL
Now I have another question:
I have an Image table in the DB where I keep track of the images so they can be linked to other records...
How can I keep the Image table in sync with the images being uploaded renamed or deleted ?
Is there a way without modifying the source code of the commands ?
Re: Dynamic base directories and ACL
This way it would be possible to inject your own code into connector and easily upgrade in the future.
For now, I'd suggest creating your own hook system.
This way you can reduce changes in the core to the minimum.
After creating all necessary changes in the core, save your changes as a diff file to be able to apply same changes in the future.
example:
in config.php, create a $ckfinderHooks array and add your hook to the global array of hooks:
in core\connector\php\php5\CommandHandler\DeleteFile.php
after:
add:
ckfinder_hook function should use $ckfinderHooks array to find all hooks that have to be executed and launch them with call_user_func_array().
In the example above, we could have:
Similar trick may be used in all other commands (Fileupload, RenameFile, DeleteFolder etc.)
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Dynamic base directories and ACL
Re: Dynamic base directories and ACL
Things are going rather good, but I have a problem when I want to send a custom error to the browser using for example:
The XML sent to the browser seems good:
The error is:
A has no properties
Line 34
var ao={es:function(A,B){var C=new RegExp('(?:[\?&]|&)'+A+'=([^&]+)','i');va...
For upload, I get around by calling directly:
, but for delete I did not find a workaround.
Any idea?
Re: Dynamic base directories and ACL
Maybye if there is a problem with database, just save some debug info into the text file and try to execute all those queries as soon as the database is available (after checking if it is still required to run this query).
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Dynamic base directories and ACL
One case where I would need to send a user defined message is for Folder Delete because I don't want people to delete non empty folders as it is a pain to update the DB recursively, but I guess I could just disable Folder Delete in the context menu by setting the Folder Delete bit to 0 when the folder is not empty.
In that case, I tried in GetFolders.php before creatinf the node :
but it disables the node even when the folder is not empty.
Re: Dynamic base directories and ACL
Re: Dynamic base directories and ACL
This works:
and the function:
It might be good in a future version to have a configuration option to not be able to delete non empty folders.
Re: Dynamic base directories and ACL
I agree.