====== aclplusregex Plugin ====== ---- plugin ---- description: Dynamically extend DokuWiki ACLs based on regex rules author : Anna Dabrowska + Andreas Gohr email : dokuwiki@cosmocode.de type : action lastupdate : 2023-11-13 compatible : Greebo depends : conflicts : similar : tags : acl downloadurl: https://github.com/cosmocode/dokuwiki-plugin-aclplusregex/zipball/master bugtracker : https://github.com/cosmocode/dokuwiki-plugin-aclplusregex/issues sourcerepo : https://github.com/cosmocode/dokuwiki-plugin-aclplusregex/ donationurl: screenshot_img : ---- [[https://www.cosmocode.de/en/open-source/dokuwiki-plugins/|{{ https://www.cosmocode.de/static/img/dokuwiki/dwplugins.png?recache|A CosmoCode Plugin}}]] This plugin allows you to set up additional [[:acl|Access Control Lists (ACL)s]] based on user's names or groups. This is especially useful where users come from external sources (like Active Directory) and follow a certain naming scheme. ===== Installation ===== Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually. ===== Configuration ===== ACLs for this plugin have to be created manually in a config file named ''aclplusregex.conf'' located in your wiki's ''conf'' directory. The syntax of that file follows the regular ACL configuration with the three whitespace separated fields for the //page/namespace//, //user/group regexp//, ACL level((Refer to [[acl#background_info|Background Infos on ACL]] for the different levels)). Unlike in the normal ACL configuration, the user/group part expects a regular expression. If it matches against the current user's login or groups the line will be treated as an additional ACL configuration. The special thing about this plugin is is that you may use any matched pattern groups from the regexp in the page/namespace part. In addition, placeholders may be used: a ''*'' to match a single namespace or pagename and ''%%**%%'' to match an arbitrary number of namespaces. The file can also be edited through the [[plugin:confmanager|Confmanager Plugin]]. :!: Important: Be sure you are familiar with DokuWiki's ACL system and with writing regular expressions. If you mess up the configuration, you may give unintentional access In addition to the configuration file, there is an additional config setting that can be changed via the [[plugin:config|Configuration Manager]]. The plugin can either run ''AFTER'' or ''BEFORE'' DokuWiki's default ACL handling. In ''AFTER'' mode, the plugin will check the ACLs defined by this plugin and will only apply a result if it is higher than the one that DokuWiki found in its own ACL setup. This is probably what most users want. In the ''BEFORE'' mode all plugin defined rules are checked before DokuWiki does its own checks and if there are any rules that apply to the current user, these rules are applied and no further checking by DokuWiki is done. This may be the mode you want if you have a large amount of dynamic rules as this may be faster. ==== Examples ==== Imagine you have customer logins following the following naming scheme: ''customer__''. You now want to give those customers read access to their own area in your wiki under ''docs:customer::''. Here's how to do it: docs:customer:$1:* ^customer_(\d+)_.* 1 For a user with the username ''customer_0815_joe'' the following ACL rule would be applied: docs:customer:0815:* customer_0815_joe 1 Please note that above example use the ''*'' placeholder. The rule would match ''docs:customer:0815:foo'' but not ''docs:customer:0815:foo:bar''. Use the ''%%**%%'' placeholder to match all namespaces bolow. A similar setup could be done where you have two groups for each customer: ''customer__write'' and ''customer__read''. You could use this to give different access levels to the customer namespace: docs:customer:$1:* ^@customer_(\d+)_read$ 1 docs:customer:$1:* ^@customer_(\d+)_write$ 4 Please note that groups are prefixed with an ''@''. Assuming user ''joe'' is in both groups, the result would look like this: docs:customer:0815:* joe 1 docs:customer:0815:* joe 4 You can also use regular expressions in the id part of the configuration line like this: docs:customer:$1:(\d{3}) @customer_(\d{5})_sub 4 Note that you **have to** define your pattern as a group and put it in parentheses, otherwise it won't be recognized as regex. The above would allow user in a group like ''@customer_54321_sub'' to create pages in namespaces such as * ''docs:customer:54321:001'' * ''docs:customer:54321:002'' * ''docs:customer:54321:003'' ===== Changleog ===== {{rss>https://github.com/cosmocode/dokuwiki-plugin-aclplusregex/commits/master.atom date}} ===== Releases ===== {{rss>https://github.com/cosmocode/dokuwiki-plugin-aclplusregex/releases.atom description author}}