Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
[SOLVED] Determine user's ACL group
Avatar
absolutejam #1
Member since May 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: [SOLVED] Determine user's ACL group
Hi,

I've only just discovered, installed and began delving into DokuWiki within the last 2 days and so far I've gotta say, I'm amazed!

I seem to have found just about everything I need with plugins and community input, but one thing I'm falling short with is being able to find ACL information in-page (or in-document) so I can show content accordingly.

My Wiki uses 2 main parent namespaces - :Public and :Internal - and the plan is to show different content in the sidebar depending on whether or not the user is in the @staff ACL (If they are, they then have access to the :Public namespace).

I've used some google-fu and I've searched the forums but can't anything that I can use except possible https://www.dokuwiki.org/tips:display_acls but I have no idea how to even simplify that and make it work for my means.

If anyone could advise me on where to start or could provide some much-needed input, I'd be really appreciative.

Thanks for your time,
James.
This post was edited on 2014-05-23, 00:53 by absolutejam.
Rene #2
Member since Jan 2014 · 191 posts
Group memberships: Members
Show profile · Link to this post
Did you set up Access Control List Management
doku.php?page=acl

ACL in Dokuwiki works like "is this user allowed to" instead of "this page/namespace is only for" , like in normal user rights settings for files and directorys.

You can find an example about a setup on this page : https://www.dokuwiki.org/acl#acls_by_example

Most navigation plugins respect ACL rules and only show content the user is allowed to.
Avatar
ach (Administrator) #3
Member since May 2006 · 1956 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
In reply to post #1
It's unclear to me what your specific question is. You describe various problems...

being able to find ACL information in-page (or in-document) so I can show content accordingly

Those are two different issues, both of which could be solved by installing some plugins. Best look at all plugins tagged with "acl".

My Wiki uses 2 main parent namespaces - :Public and :Internal - and the plan is to show different content in the sidebar depending on whether or not the user is in the @staff ACL (If they are, they then have access to the :Public namespace).

You wouldn't need a plugin for that, as you could simply have a different sidebar per namespace. (Unless I misunderstood something.)
Avatar
absolutejam #4
Member since May 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
Honestly, I never even thought about having different sidebars per namespace - nor did I think it was innately possible - That would be a much easier solution for this problem. I've found plugin 'sidebarng' and I'll look into that to eliminate this problem.

However, the problem is still there if I wanted to edit any parts of the template and get the user's ACL groups. Some scenarios where this is useful:
Example 1 - Add a link to the user's ACL group(s) (I currently have a link to the user's own user page)
Example 2 - Only @admin ACL group can see an admin menu on the template.
So basically, I would need a way to get a list of the user's ACL groups (An array with the ACL groups for example) then I can either loop through each one or use if/case statements to display certain items.

I have looked at the ACL plugins and none of them do what I want, but I guess I'll have to try and dissect one of existing ACL plugins to see if I can find what I need.

Thanks for help so far.
Avatar
ach (Administrator) #5
Member since May 2006 · 1956 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by absolutejam:
Honestly, I never even thought about having different sidebars per namespace - nor did I think it was innately possible - That would be a much easier solution for this problem. I've found plugin 'sidebarng' and I'll look into that to eliminate this problem.

If you're using any template which uses tpl_include_page() for creating the sidebar (including the default "dokuwiki" template), then you don't need any specific sidebar plugin. Simply add a new sidebar page in your namespace and all pages in that namespace (and sub namespaces) will automatically show that sidebar instead of the one in the root namespace.

Quote by absolutejam:
Example 1 - Add a link to the user's ACL group(s) (I currently have a link to the user's own user page)
Can you please explain further? As there are no "links to users' ACL groups", this must be either a plugin or something custom-built? Or does that not exist yet and you plan to build it? If the latter, can you explain more about the (potential) setup of the wiki? Will there be a page for every group and for every user? Like user:foo, group:bar, etc?

Quote by absolutejam:
Example 2 - Only @admin ACL group can see an admin menu on the template.

Do you mean having several menus in the sidebar and one of them should only be visible to admins?
I think that's what the ifauth plugin could do. Or you could include a page from a restricted namespace.

Quote by absolutejam:
So basically, I would need a way to get a list of the user's ACL groups (An array with the ACL groups for example)

Oh, you're asking from a developer's viewpoint, not a user's?
That's as easy as $INFO['userinfo']['grps'].
Avatar
absolutejam #6
Member since May 2014 · 4 posts
Group memberships: Members
Show profile · Link to this post
Ah, it seems that the template I used had a custom function for getting the sidebar. I've copied the one from the default template and it's working. Thanks for that :)

Again, I've not explained it very well, but I've created group areas (group:<groupname>) and user areas (user:<username>) but with your help and a bit of perseverance I've sorted all of this.

I've edited the template to do what i needed, but thanks for the alternatives, they are what I was originally looking for.

I have delved into some more of the innards and the XRef to give me a better idea about how things work with DokuWiki, but shockingly I must have missed the $INFO['userinfo'] section a dozen times.

Sorry for any vague questions, I know how annoying it can be to try and answer such ambiguous requests, but your help has been greatly appreciated.


Thanks for your help.
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:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-26, 15:30:54 (UTC +01:00)