Community Support for OpenDocMan (Deprecated)

Full Version: Locking uploads to most users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
orangos
2004-11-11 09:26:17 PST
Is there a way to prevent non-admin users from uploading files at all, please?

I suppose it'd be possible to write a hack to hide the 'Add file' link depending on user type, but that seems a little kludgy...

Many thanks.


logart
2004-11-11 09:34:56 PST
That feature is not included. Anyone with login perms can add a file (although they are not available until a reviewer authorizes them).

You could add a config.php entry for admin_only_upload = yes and then add a test in add.php to see of that is set, if so, only allow admin.

steve


logart
2004-11-11 09:35:41 PST
By the way, if you do make that change, I would like the changes also so I can add it to the next release.

steve


orangos
2004-11-11 09:38:48 PST
I'd be delighted to try, though my php skills are crunch to say the least.


orangos
2004-11-11 09:40:00 PST
OK. That sounds like a good route. Thanks.
This does not work I added the following entry in config.php but non admins can still see and upload files

// Admin only upload option
'admin_only_upload' => 'On',

Anyone got it working?
I did this by hiding the Add button for non admin users...

Actually in my hack, the buttons are rendered within a helper file...so I wrote a validation clause around the add button display to let it be shown to only admins... if you have to change it on all pages, it wont be easy to manage
Yeah I pretty much would be happy to do that i.e; non admins can't see the Add button. However I'm not as savy in programming as you are Sad. If you'd like to share your mod I'll greatly appreciate it and I'm sure lot of other people. If not I totally understand.
In case someone is still looking... A quick fix for me was to modify the templates/default/header.tpl file. In the header.tpl file around line 44 change the following lines to hide buttons from all but uid=1, uid=1 is admin for me:

Code:
{if $smarty.session.uid == 1} <a href="{$g_base_url}/add.php" class="regular"><img src="{$g_base_url}/images/plus.png" alt="add file"/>{$g_lang_button_add_document}</a>{/if}