AuthUserCMSLike

Summary: Restricts access to PageActions by role
Version: 1.0
Prerequisites:
Maintainer: BenWilson
Categories: CMS

Question

Some people want to merge the "best features" of UserAuth and AuthUser. Among these is integration with CMSLike. Is it possible to have CMS behavior with AuthUser?

Answer

A site may have CMS Like behavior while using AuthUser without fancy footwork.

Create the CMS Menu. PmWiki already comes with a page dedicated to the page actions Site.PageActions. So, all we need to do is adjust this page to allow for role-based options. Here is an example.

(:if ! [ auth admin || authid ] :)
[[{$FullName}?action=login|$[login]]]
(:if [ auth admin || authid ]:)
[[{$FullName}?action=logout|$[logout]]]
(:if auth edit:)
· [[{$FullName}?action=edit|$[edit]]]
· [[{$FullName}?action=diff|$[history]]]
(:if auth admin:)
· [[{$FullName}?action=attr|$[attr]]]
· [[{$SiteGroup}.AuthUser?action=edit|$[users]]]

Notes

  • This recipe was last tested on PmWiki version: pmwiki-2.5.9
  • This recipe requires at least PmWiki version: any version with PmWiki.AuthUser

Releases

No releases, just information

See Also

Contributors

BenWilson August 23, 2006 -- Updated. BenWilson December 30, 2005 -- Initially Written

Comments

See discussion at AuthUserCMSLike-Talk


User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_COOKIE] => PHPSESSID=hof79nhgrqqhuoanv8grmk0pk4
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => https://www.pmwiki.org/wiki/Cookbook/AuthUserCMSLike,
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fAuthUserCMSLike
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fAuthUserCMSLike
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/AuthUserCMSLike
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/AuthUserCMSLike
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afH6fTkvRrCO8CYuMW7UBwAAAVI
            [REDIRECT_URL] => /wiki/Cookbook/AuthUserCMSLike
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 50410
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/AuthUserCMSLike
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/AuthUserCMSLike
            [SCRIPT_URL] => /wiki/Cookbook/AuthUserCMSLike
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afH6fTkvRrCO8CYuMW7UBwAAAVI
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777465981.2655
            [REQUEST_TIME] => 1777465981
            [argv] => Array
                (
                    [0] => n=Cookbook%2fAuthUserCMSLike
                )

            [argc] => 1
        )

)