Skip to content

Commit

Permalink
allow disabling the user validation
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed Jul 11, 2023
1 parent 4cc89dd commit 5446fe2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class helper_plugin_attribute extends DokuWiki_Plugin
public $success = false;
protected $storepath = null;
protected $cache = null;
protected $secure = true;

/**
* Constructor
Expand All @@ -35,6 +36,19 @@ public function __construct()
$this->cache = array();
}

/**
* Allows overriding the secure setting
*
* When set to false, no user validation checks are made.
*
* @param bool $secure
* @return void
*/
public function setSecure($secure)
{
$this->secure = $secure;
}

/**
* Return info about supported methods in this Helper Plugin
*
Expand Down Expand Up @@ -120,12 +134,16 @@ public function getMethods()
* Otherwise the name of the logged in user is supplied. If no user is
* logged in, null is returned.
*
* This check can be disabled with the setSecure() method.
*
* @param string $user
*
* @return null|string
*/
private function validateUser($user)
{
if(!$this->secure) return $user;

// We need a special circumstance. If a user is not logged in, but we
// are performing a login, enable access to the attributes of the user
// being logged in IF DIRECTLY SPECIFIED.
Expand Down

0 comments on commit 5446fe2

Please sign in to comment.