access_control1Add my vote for this tag security3Add my vote for this tag create new tag
, view all tags


Shows if authentication required to view the current page or not


The SecurityPlugin implements a TWikiVariable which will show weather the page being viewed needs authentication or not. Authorization is another issue. Hopefully this is easier and more intuitive than telling users to check whether the current URL has view or viewauth in it.

The Plugin is quite simple, it uses TWiki::Func::isGuest to check if the page is authenticated or not. This relies on the fact that URL linking to other topics use the view CGI and authenticated pages are referred from the view CGI to the viewauth CGI (if installed). Of course one could make a page appear authenticated by adding auth to the URL (or linking to a URL with viewauth) but this won't happen on the next page if the user acts normally and clicks on the links.

Syntax Rules

Place a %SECURITY% variable in any page (or WebLeftBar or WebTopBar), it will return the contents of %SECURITYLOCKED% or %SECURITYUNLOCKED% depending on whether the page being viewed is authenticated or not.


You type Simulated locked Simulated unlocked If installed
%SECURITY% viewable by authenticated user only according to authorization viewable publicly %SECURITY%

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %SECURITYPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Shows if authentication required to view the current page or not

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • My own settings:
    • Set SECURITYLOCKED = viewable by authenticated user only according to authorization
    • Set SECURITYUNLOCKED = viewable publicly

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip SecurityPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/SecurityPlugin.txt Plugin topic
    lib/TWiki/Plugins/SecurityPlugin.pm Plugin Perl module
    pub/TWiki/SecurityPlugin/unlocked.gif Unlocked lock image
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:
    • %SECURITY% <= there should be a little picture of a lock (locked or unlocked)
    • this of course depends on your settings for SECURITYLOCKED and SECURITYUNLOCKED and the rights required to read this page
    • See also the Examples section above
  • Customize the Variables if desired

Plugin Info

Plugin Author: TWiki:Main.MichaelGindonis
Copyright: © 2005 TWiki:Main.MichaelGindonis;
© 2008-2010 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2010-12-30 (V1.1)
Change History:  
2010-12-29: TWikibug:Item6530: Doc improvements; updated unlocked icon; change TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny
2005-07-13: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.022
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, SecurityPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/SecurityPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/SecurityPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/SecurityPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins, TWikiUserAuthentication

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 SecurityPlugin.md5 r4 r3 r2 r1 manage 0.2 K 2010-12-31 - 06:51 PeterThoeny  
Compressed Zip archivetgz SecurityPlugin.tgz r4 r3 r2 r1 manage 5.1 K 2010-12-31 - 06:51 PeterThoeny  
Compressed Zip archivezip SecurityPlugin.zip r5 r4 r3 r2 r1 manage 7.0 K 2010-12-31 - 06:51 PeterThoeny  
Unknown file formatEXT SecurityPlugin_installer r2 r1 manage 3.4 K 2010-12-31 - 06:51 PeterThoeny  
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2013-10-16 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.