Motivation
A context makes for a much simpler and shorter IF statement.
(Foswiki has this feature.)
Description and Documentation
I find it to be very useful to mark sections of topics for admin eyes only. A context would make re,e,bering this syntax (and creating variables with it) much easier.
Examples
%IF{"context isadmin" then="..." else="..."}%
vs
%IF{"'%USERNAME%' ingroup 'TWikiAdminGroup'" then="..." }
Impact
Implementation
--
Contributors:
Vicki Brown - 2017-03-19
Discussion
TWiki has already
context in the
IF{} variable.
Agreed that adding
isadmin to context is a useful small enhancement.
If you are committed to implementing this set the date and name in the form. Please review
TWikiReleaseManagementProcess.
--
Peter Thoeny - 2017-03-19
One thing to note is that
TWikiAdminGroup does not necessarily determine whether a user is an admin or not.
By default, that's the case since TWiki::Users::TWikiUserMapping::isAdmin() behaves that way.
A while back, I introduced
TWiki::Users::isAdmin(), which calls the
isAdmin() of the currently effective user mapping.
So now it's easier than before to introduce the isadmin context. It's only a matter of calling
TWiki::Users::isAdmin().
--
Hideyo Imazu - 2017-03-21
Also, for now you could simple define a site-wide ISADMIN variable that returns 0 or 1 based on an IF with ingroup.
--
Peter Thoeny - 2017-03-21
Feature discussed at
KampalaReleaseMeeting2017x04x06:
- No commit date and developer, wait until committed developer
- Can also be done with a setting:
-
Set ISADMIN = %IF{"'%USERNAME%' ingroup 'TWikiAdminGroup'" then="1" else="0" }%
- Set ISADMIN = 0
- Results in: 0
--
Peter Thoeny - 2017-04-09