Not logged in. · Lost password · Register
Forum: General Help and Support Plugins Plugin Wishlist RSS
Users Permission for Pages and Namespace
This is Not about Userwildcards or Users Profile Page. Its for whole wiki.
Page:  1  2  next 
Avatar
strang3r #1
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
Subject: Users Permission for Pages and Namespace
Hi, I wanted to see some plugin for dokuwiki for giving user permission of admin for the page they create with a namespace. So that mean other user cannot edit that page. But yes they can create a different page in that namespace. Namespace will act here as category. I have seen User wildcard but that don't work with this. I am not talking here about Users personal page, Its for whole dokuwiki. This page can user create anywhere like it can be done in a namespace with wiki:pagename or wiki:subnamespace:pagename etc. This type of 2 permission can be seen in Tikiwiki which are ....
1. Users are admin of their own pages.
2. Users cannot edit other Users pages.

So, I am droping this in plugin whislist. Hopefully someday an expert coder will be think about this or it will be just stay as scrap.

For more info about this please visit: http://forum.dokuwiki.org/post/29438

Regards.
Avatar
HansBKK #2
Member since Nov 2011 · 104 posts · Location: Bangkok
Group memberships: Members
Show profile · Link to this post
I am finding it difficult to understand exactly what you're asking for.

Therefore I will try to write *your own thoughts*  as I understand them from your language in my own words.

Please correct and clarify.

User1 creates PageA in namespace Alpha.

User2 creates PageB, also in namespace Alpha.

You want a permissions facility that automatically prevents User2 from editing PageA - only User1 can do so. And likewise only User2 can edit PageB. Anyone can read anything anywhere.

Do you want that type of automatic permissions assignment to depend on the fact that the pages are created in the namespace Alpha, or in any namespace created by User1, or in any namespace at all?

> wiki:pagename or wiki:subnamespace:pagename

I'm not sure why you're using the "wiki" namespace for your examples, probably best to continue with the examples I gave above when clarifying your desired functionality.

Hope this helps.
Avatar
strang3r #3
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
Sorry about the "wiki" part. Just ignore it. I used it for namespace.

Yes, you have got it right about my thoughts.

I need the automatic permissions for whole user group. So,

It will be prevent User1 PageA from getting edited by User2

And same permission for User2 PageB and rest of other users.

Which can be for Alpha namespace or any other namespace where they are allowed to create the pages.
User cannot use the same page name for creating a page if their is a page already created by another User.


If you gets any difficulty to understand. please let me know. My English is not so good.
Avatar
turnermm (Moderator) #4
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
In reply to post #1
Try this. If it works, I'll make a plugins page for it.

It gives only the creator of the page and the admins access to the page.  It doesn't change the permissions.  It only blocks.  So, if your users don't have upload permission to the namespace, this doesn't change that. 

Unzip it in your plugins directory.
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
The author has attached one file to this post:
privacy.zip 588 Bytes
You have no permission to open this file.
Avatar
strang3r #5
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
Its working perfect for creator of the page and admin, But non logged in users (Guest) and other users who are not the creator of the page cannot view it as it gets blocked. Can we turn this function on? so rest of other can read it only but not edit it. Because without this it is 50% of my thoughts just completed. Thank you!
This post was edited on 2011-12-12, 15:42 by strang3r.
Avatar
turnermm (Moderator) #6
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
I thought that was what you wanted.

On line 31, where it says:   
$INFO['perm']=0;
change the zero to one:
$INFO['perm']=1;

This will give anyone read permission.  So, you can't have any secrets.  Right now I don't have time to check ACL permissions.
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
strang3r #7
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
I am sorry, but i have already tried that but its also let every user to edit other user pages.

*I want user have access to  create a page with or without a namespace

*which is readable by other user .

*Only page creator and admin can edit that page.

I dont want the page to be secret, I just dont want them to be get edited by other users beside Admin, Manager and Creator of the page.
Avatar
turnermm (Moderator) #8
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
i have already tried that but its also let every user to edit other user pages.
Interesting.  Well, then this new version should work.
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
The author has attached one file to this post:
privacy.zip 606 Bytes
You have no permission to open this file.
Avatar
HansBKK #9
Member since Nov 2011 · 104 posts · Location: Bangkok
Group memberships: Members
Show profile · Link to this post
Subject: closure?
So just to clarify what this "rough patch" does, I'll try to sum up, please correct me if I'm wrong:

Any user can create any page in any namespace.

Once created, that user becomes in effect the "owner" of the page, and only that user can edit that page.

Any user can view any page in any namespace.

I believe the OP was also talking about groups at one point rather than just users?

? Any user belonging to the same group as the creating user can edit the page ?

Does that apply here?

If so, what happens if the user belongs to more than one group? I believe DW doesn't have the concept of a "primary group" does it?

If this option were to "go mainstream" via a plugin, its interact with the core ACL functionality would need to be clearly delineated, I could see things going pear-shaped pretty quickly, especially for us noobs. . .
Avatar
turnermm (Moderator) #10
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
Any user can create any page in any namespace.

Once created, that user becomes in effect the "owner" of the page, and only that user can edit that page.
Yes, except that an administrator or manager also has write access.

Any user can view any page in any namespace.
Only if the user has read access through the ACL permissions. 

Any user belonging to the same group as the creating user can edit the page ?

Does that apply here?
No.  Only the user who created the file and the admins can edit it.  Which is what strang3r asked for.    He can set
      *   @ALL 1
      *  @user 4
which gives everyone read permission and users create permission.  The plugin stops anyone who hasn't created a file from editing it.   It's not a solution for wikis where groups have to edit the same file.
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
HansBKK #11
Member since Nov 2011 · 104 posts · Location: Bangkok
Group memberships: Members
Show profile · Link to this post
I'm not speaking on the OP's behalf, but from his past posts (> My English is not so good.):

> I need the automatic permissions for whole user group.

> Both user1 and user2 is User Group.

> for the permission i want to give to a user group.

Note I'm also not advocating this for myself  - it's true that trying to handle groups would raise complications - just trying to help clarify the discussion.
Avatar
strang3r #12
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #10
@turnermm: Thank you so much, Its really working. That is what i wanted to be have for user group permission. 100% nicely done :D. thanks again for your hard working and times :) God bless you.

*Is there any way to remove the "Edit this page" button which is not functional for the user who cannot edit page (Not owner of Page). Because that button still showing to the user who cannot edit page. well if its not possible then that is not a problem. Just asking to make it clean and good looking.


@HansBKK: Sorry, I didn't know how to explain this in more details. But I think turnermm already taken care of it. Thank you for your time & help.
This post was edited 2 times, last on 2011-12-13, 13:02 by strang3r.
Avatar
turnermm (Moderator) #13
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
Is there any way to remove the "Edit this page" button which is not functional for the user who cannot edit page (Not owner of Page). Because that button still showing to the user who cannot edit page. well if its not possible then that is not a problem. Just asking to make it clean and good looking.

Place the following code near the top of your main.php.  Make sure it is not included inside another <?php . . . . ?> block.
<?php 
  function _userCanEdit() {   
       global $INFO;
       global $ID;       
       $wiki_file = wikiFN($ID);   
       if(@!file_exists($wiki_file)) return true;
       if($INFO['isadmin'] || $INFO['ismanager'] ) return true;  
       $meta_file = metaFN($ID , '.meta'); 
       if(!$INFO['meta']['user']) return true;
       if( $INFO['client'] ==  $INFO['meta']['user']) return true;
       return false;
    }
 ?>
Wherever you find 
<?php tpl_button('edit')?>
replace it with:       
<?php
           if(_userCanEdit() ){     
            tpl_button('edit');
          }         
  ?>

Most templates have two edit buttons.
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
strang3r #14
Member since Dec 2011 · 25 posts
Group memberships: Members
Show profile · Link to this post
Hi, My template is different then the default template. I am using the arctic template. I followed your steps and codes...

1.) Pasted the 1st code around top location in my main.php. they were in their own php <?php . . . . ?> block and not in another.

2.) I have found 2 buttons in 2 php code block.

<div class="bar-left">
          <?php
            if(!tpl_getConf('closedwiki') || (tpl_getConf('closedwiki') && isset($_SERVER['REMOTE_USER']))) {
                switch(tpl_getConf('wiki_actionlinks')) {
                  case('buttons'):
                    // check if new page button plugin is available
                    if(!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
                      $npd->html_new_page_button();
                    } 
           tpl_button('edit');
                    break;
                  case('links'):
                    // check if new page button plugin is available
                    if(!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
                      $npd->html_new_page_button();
                    }
                    tpl_actionlink('edit');
                    break;
                }
            }
          ?>
        </div>


and another one is...


<div class="bar-left">
        <?php
          switch(tpl_getConf('wiki_actionlinks')) {
            case('buttons'):   
            tpl_button('edit');
                tpl_button('history');
              break;
            case('links'):
                tpl_actionlink('edit');
                tpl_actionlink('history');
              break;
          }
        ?>
      </div>


and I only replaced the tpl_button('edit'); with....


if(_userCanEdit() ){    
            tpl_button('edit');
          }

But, edit button is still showing up. I think I have done something wrong. Help please?
Avatar
turnermm (Moderator) #15
Member since Oct 2009 · 2320 posts
Group memberships: Global Moderators, Members
Show profile · Link to this post
Wherever you see
tpl_actionlink('edit');

Replace it with

if(_userCanEdit() ){   
           tpl_actionlink('edit');
          }
Myron Turner
fckgLite (&ckgedit): http://www.mturner.org/fckgLite/
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Current time: 2014-04-17, 02:52:30 (UTC +02:00)