Do you have some feature in mind that you'd love to see in Couch? Let us know.
15 posts Page 1 of 2
Hello, I've bin using the CouchCMS on some websites in the past and I like it very much.
Now I am working on a website where the client wants different administrators to be able to edit different sections of the website. This means restricting certain administrators from editing pages they are not supposed to edit.

I have bin looking in the documentation and on this forum, but I believe this function is not yet available out-of-the-box. At a moment I thought I had found it with User Access Levels, but this is for the front end users. I need administrator access restrictions in the back-end CMS.

Anybody have any idea if/and how/ this would be possible with the current version of CouchCMS1.4 ???

Thanks in advance!
Welcome to our forums, graphicsco :)

I am afraid, currently there is no straightforward way of making the separation between admins that you mentioned.
Okay, that is to bad... That means I need to try different methods which might go a little deeper.

I've tried using one Couch installation on two databases, so I could split the website in two parts, which each they're own admin login. This means two config.php files and two index.php files: lets call them index1.php and index2.php and so on... they include to the corresponding config1.php and config2.php

But this goes beyond config and index, also header.php must be copied as two versions... Then cms.php requires the same treatment, but I can't find where cms.php is linked, so I can't include a version 1 and 2, if you get that I'm on about...

Is this a good idea, or has this inspired anybody in to thinking of a way I could have two CMS installations running to separate the two sections of the website???

Thanks in advance...
I don't think renaming the files will work at all!

Not sure how complex your templates are but you can try using Databound forms ( ... forms.html) to create admin-panel like functionality on the frontend using normal Couch templates.
These templates then can be restricted/allowed to specific users.

Will require additional work but, done properly, this can almost perfectly mimic the admin-panel (of course, allowing you to customize it as you wish).

This is the best we can do for now, I am afraid.

BTW, can you please post in the exact scenario of how the restriction will work? I mean, will there be different levels of admins or simply multiple admins of same levels. How will the restrictions work etc.

Thanks for this. It might be really close to what I'm looking for.

The client wants one admin to be able to edit page 1 and 2, and another admin to be able to edit page 3 and 4 (for instance)...

Not sure how hard this would be to implement in a future release, but this seems like it could be very easy to implement and very straight forward for end users as well. Let me know what you think.

Code: Select all
<cms:editable name='main_content' type='richtext' users='username1, username2, username3'>

Just adding a new variable to editable regions to allow a username(s) to be defined, and only those users are able to access that editable region via inline editing, front end bound form or Admin Panel.

This would allow more infinite restriction as to who can edit what, but keeps it very simple, without involving setting users to access certain templates or setting folder access etc.
I have been able to setup my install in a way that specific users can only access specific sections of the admin panel, so each user can only edit his own section of the website.

Though i had to edit core files.

In your install folder their is a file called "functions.php"
The admin panel's header is generated here under a function called "render_admin_page_ex"

Code: Select all
function render_admin_page_ex( $_p ){

After this block of code:

Code: Select all
    foreach( $this->styles as $k=>$v ){
        echo '<link rel="stylesheet" href="'.$v.'" type="text/css" media="screen" />'."\n";

I added:

Code: Select all
if( strtolower($AUTH->user->title)=="kellie"){            
    $actual_link = $_GET['tpl'];
        header('Location: ?act=list&tpl=2');
    echo "<style>.templates{display:none}</style>";
}elseif( strtolower($AUTH->user->title)=="shane"){
    //etc.. etc...

The section where you see:
Code: Select all
echo "<style>.templates{display:none}</style>";

can also be used to hide individual admin panel sidebar links.

Code: Select all
#sidebar > ul > li:nth-child(4),
#sidebar > ul > li:nth-child(7),
#sidebar > ul > li:nth-child(10){

I'm sure this will break every update, but that's my temporary fix after searching and not finding a better solution.
If a better solution is not found soon, i will be adding a super admin feature to add/remove page access to individual admins soon.
Shuford Technology,

I would love to see any work you do on
super admin feature to add/remove page access to individual admins soon.

On a similiar note, I have found that the below code will work to limit access via front end editing. Have not tested or figured out yet for bound forms, but this works for setting user access per editable region for inline or popup editing via the front end.

Code: Select all

    <cms:if k_user_name=="testuser" || k_user_name=="testuser1"><cms:inline_edit 'main_content' />>


Code: Select all
 <div><cms:if k_user_name=="testuser" || k_user_name=="testuser1"><cms:popup_edit 'main_content' /></cms:if>

Note the DIV is not part of this, but left in to illustrate that it needs to be within block level element for inline. Also in both cases, you want this to be placed outside the editable region tags. This only allows testuser and testuser1 access to edit. Add additional users by repeating string starting with double pipe.

The only snag I have run into with this is it disables the capability of the super admin account to edit the regions via the front-end. Perhaps KK can add something to this to make the super admin continue to work. (Adding username to above example for super admin does not work)
@shuff19, inline editing works only for admins. So, the users you are assigning access in your code can anyway login into the admin panel and edit anything they want.
Hope you have that in mind.

As for your specific question, you can add admin to the list of users you are checking for.
KK, thanks for the tip, what I am going to try to do, is something like:

When a user logs in (anyone except "admin" (super user) it will redirect them to a page other than the admin panel. possibly a page somehow set to that username. This way all the admins will be able to edit pages they are defined in from the front end, but will not have direct access to the admin panel. Only super admin login will have access to admin panel. Any help with that is appreciated. I understand I can probably accomplish this with bound form for every page, but trying to avoid as the site I have in mind will have many different pages and subsections with many contributors.
15 posts Page 1 of 2

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 1 guest