[pmwiki-users] syntax question php for a Profiles.php

The Editor editor at fast.st
Fri Nov 17 16:04:25 CST 2006


On 11/17/06, Florian Fischer <Flori-Fischer at gmx.net> wrote:
> Hello,
>
> i'm using Userauth and since i haven't found a possibility to restrict the edit-access to the pages of a user, i try it with a workaround. My Users have edit-rights for the Group Profiles. But User B shouldn't be able to edit the pages of User A. There is no automatic way to do this. I try it with a Profiles.php file
>
> $pagename = ResolvePageName($pagename);
>  $isAdminAuthorized = CondAuth($pagename, 'admin');
>  global $Author;
>  if (!$isAdminAuthorized) {
>     if ($pagename != '{$Author}' || $pagename != '{$Author}-Contribution' || $pagename != '{$Author}-Watchlist'){
>     if ($action == 'edit') $action = 'browse';}
>
>  }
>
> But i don't know how to turn the if clause right
>
> if (!$isAdminAuthorized) {
>     if ($pagename != '{$Author}' || $pagename != '{$Author}-Contribution' || $pagename != '{$Author}-Watchlist'){
>     if ($action == 'edit') $action = 'browse';}
>
> i don't know what exactly is in $pagename and i don't know how to use the {$Author} in the condition.
>
> Any ideas?
>
> FLorian


Not sure I understand exactly what you are trying to do, but $pagename
should return Group.Name.  So you may want to put groups in your
conditionals.

Also, I'm not sure about using page variables directly in a local
config file.  In my ZAP recipe for example, I had to use
$GLOBALS[AuthId].  I'm not an expert on all this stuff, so someone
else will have to chime in, but this might give you something to start
with.

Cheers,
Caveman




More information about the pmwiki-users mailing list