Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UsersManager/API.php')
-rw-r--r--plugins/UsersManager/API.php124
1 files changed, 62 insertions, 62 deletions
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index fda72c78c3..4c226b65e3 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -32,7 +32,7 @@ class Piwik_UsersManager_API
*
* @return array the list of all the users
*/
- static public function getUsers()
+ public function getUsers()
{
Piwik::checkUserIsSuperUser();
@@ -46,7 +46,7 @@ class Piwik_UsersManager_API
*
* @return array the list of all the users login
*/
- static public function getUsersLogin()
+ public function getUsersLogin()
{
Piwik::checkUserHasSomeAdminAccess();
@@ -75,11 +75,11 @@ class Piwik_UsersManager_API
* )
*
*/
- static public function getUsersSitesFromAccess( $access )
+ public function getUsersSitesFromAccess( $access )
{
Piwik::checkUserIsSuperUser();
- self::checkAccessType($access);
+ $this->checkAccessType($access);
$db = Zend_Registry::get('db');
$users = $db->fetchAll("SELECT login,idsite
@@ -109,7 +109,7 @@ class Piwik_UsersManager_API
* ...
* )
*/
- static public function getUsersAccessFromSite( $idSite )
+ public function getUsersAccessFromSite( $idSite )
{
Piwik::checkUserHasAdminAccess( $idSite );
@@ -142,11 +142,11 @@ class Piwik_UsersManager_API
* ...
* )
*/
- static public function getSitesAccessFromUser( $userLogin )
+ public function getSitesAccessFromUser( $userLogin )
{
Piwik::checkUserIsSuperUser();
- self::checkUserExists($userLogin);
- self::checkUserIsNotSuperUser($userLogin);
+ $this->checkUserExists($userLogin);
+ $this->checkUserIsNotSuperUser($userLogin);
$db = Zend_Registry::get('db');
$users = $db->fetchAll("SELECT idsite,access
@@ -170,11 +170,11 @@ class Piwik_UsersManager_API
*
* @return array the user information
*/
- static public function getUser( $userLogin )
+ public function getUser( $userLogin )
{
Piwik::checkUserIsSuperUser();
- self::checkUserExists($userLogin);
- self::checkUserIsNotSuperUser($userLogin);
+ $this->checkUserExists($userLogin);
+ $this->checkUserIsNotSuperUser($userLogin);
$db = Zend_Registry::get('db');
$user = $db->fetchRow("SELECT *
@@ -190,10 +190,10 @@ class Piwik_UsersManager_API
*
* @return array the user information
*/
- static public function getUserByEmail( $userEmail )
+ public function getUserByEmail( $userEmail )
{
Piwik::checkUserIsSuperUser();
- self::checkUserEmailExists($userEmail);
+ $this->checkUserEmailExists($userEmail);
$db = Zend_Registry::get('db');
$user = $db->fetchRow("SELECT *
@@ -202,9 +202,9 @@ class Piwik_UsersManager_API
return $user;
}
- static private function checkLogin($userLogin)
+ private function checkLogin($userLogin)
{
- if(self::userExists($userLogin))
+ if($this->userExists($userLogin))
{
throw new Exception(Piwik_TranslateException('UsersManager_ExceptionLoginExists', $userLogin));
}
@@ -221,17 +221,17 @@ class Piwik_UsersManager_API
}
}
- static private function checkPassword($password)
+ private function checkPassword($password)
{
- if(!self::isValidPasswordString($password))
+ if(!$this->isValidPasswordString($password))
{
throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidPassword'));
}
}
- static private function checkEmail($email)
+ private function checkEmail($email)
{
- if(self::userEmailExists($email))
+ if($this->userEmailExists($email))
{
throw new Exception(Piwik_TranslateException('UsersManager_ExceptionEmailExists', $email));
}
@@ -242,7 +242,7 @@ class Piwik_UsersManager_API
}
}
- static private function getCleanAlias($alias,$userLogin)
+ private function getCleanAlias($alias,$userLogin)
{
if(empty($alias))
{
@@ -251,7 +251,7 @@ class Piwik_UsersManager_API
return $alias;
}
- static private function getCleanPassword($password)
+ private function getCleanPassword($password)
{
// if change here, should also edit the installation process
// to change how the root pwd is saved in the config file
@@ -273,19 +273,19 @@ class Piwik_UsersManager_API
*
* @exception in case of an invalid parameter
*/
- static public function addUser( $userLogin, $password, $email, $alias = false )
+ public function addUser( $userLogin, $password, $email, $alias = false )
{
Piwik::checkUserIsSuperUser();
- self::checkLogin($userLogin);
- self::checkUserIsNotSuperUser($userLogin);
- self::checkPassword($password);
- self::checkEmail($email);
+ $this->checkLogin($userLogin);
+ $this->checkUserIsNotSuperUser($userLogin);
+ $this->checkPassword($password);
+ $this->checkEmail($email);
- $alias = self::getCleanAlias($alias,$userLogin);
- $passwordTransformed = self::getCleanPassword($password);
+ $alias = $this->getCleanAlias($alias,$userLogin);
+ $passwordTransformed = $this->getCleanPassword($password);
- $token_auth = self::getTokenAuth($userLogin, $passwordTransformed);
+ $token_auth = $this->getTokenAuth($userLogin, $passwordTransformed);
$db = Zend_Registry::get('db');
@@ -311,12 +311,12 @@ class Piwik_UsersManager_API
*
* @see addUser() for all the parameters
*/
- static public function updateUser( $userLogin, $password = false, $email = false, $alias = false )
+ public function updateUser( $userLogin, $password = false, $email = false, $alias = false )
{
Piwik::checkUserIsSuperUserOrTheUser($userLogin);
- self::checkUserIsNotAnonymous( $userLogin );
- self::checkUserIsNotSuperUser($userLogin);
- $userInfo = self::getUser($userLogin);
+ $this->checkUserIsNotAnonymous( $userLogin );
+ $this->checkUserIsNotSuperUser($userLogin);
+ $userInfo = $this->getUser($userLogin);
if(empty($password))
{
@@ -324,8 +324,8 @@ class Piwik_UsersManager_API
}
else
{
- self::checkPassword($password);
- $password = self::getCleanPassword($password);
+ $this->checkPassword($password);
+ $password = $this->getCleanPassword($password);
}
if(empty($alias))
@@ -340,11 +340,11 @@ class Piwik_UsersManager_API
if($email != $userInfo['email'])
{
- self::checkEmail($email);
+ $this->checkEmail($email);
}
- $alias = self::getCleanAlias($alias,$userLogin);
- $token_auth = self::getTokenAuth($userLogin,$password);
+ $alias = $this->getCleanAlias($alias,$userLogin);
+ $token_auth = $this->getTokenAuth($userLogin,$password);
$db = Zend_Registry::get('db');
@@ -368,19 +368,19 @@ class Piwik_UsersManager_API
*
* @return bool true on success
*/
- static public function deleteUser( $userLogin )
+ public function deleteUser( $userLogin )
{
Piwik::checkUserIsSuperUser();
- self::checkUserIsNotAnonymous( $userLogin );
- self::checkUserIsNotSuperUser($userLogin);
- if(!self::userExists($userLogin))
+ $this->checkUserIsNotAnonymous( $userLogin );
+ $this->checkUserIsNotSuperUser($userLogin);
+ if(!$this->userExists($userLogin))
{
throw new Exception(Piwik_TranslateException("UsersManager_ExceptionDeleteDoesNotExist", $userLogin));
}
- self::deleteUserOnly( $userLogin );
- self::deleteUserAccess( $userLogin );
+ $this->deleteUserOnly( $userLogin );
+ $this->deleteUserAccess( $userLogin );
}
/**
@@ -388,7 +388,7 @@ class Piwik_UsersManager_API
*
* @return bool true if the user is known
*/
- static public function userExists( $userLogin )
+ public function userExists( $userLogin )
{
Piwik::checkUserHasSomeAdminAccess();
$count = Piwik_FetchOne("SELECT count(*)
@@ -402,7 +402,7 @@ class Piwik_UsersManager_API
*
* @return bool true if the user is known
*/
- static public function userEmailExists( $userEmail )
+ public function userEmailExists( $userEmail )
{
Piwik::checkUserHasSomeAdminAccess();
$count = Piwik_FetchOne("SELECT count(*)
@@ -428,11 +428,11 @@ class Piwik_UsersManager_API
*
* @return bool true on success
*/
- static public function setUserAccess( $userLogin, $access, $idSites)
+ public function setUserAccess( $userLogin, $access, $idSites)
{
- self::checkAccessType( $access );
- self::checkUserExists( $userLogin);
- self::checkUserIsNotSuperUser($userLogin);
+ $this->checkAccessType( $access );
+ $this->checkUserExists( $userLogin);
+ $this->checkUserIsNotSuperUser($userLogin);
if($userLogin == 'anonymous'
&& $access == 'admin')
@@ -456,7 +456,7 @@ class Piwik_UsersManager_API
// basically an admin can give the view or the admin access to any user for the websites he manages
Piwik::checkUserHasAdminAccess( $idSites );
- self::deleteUserAccess( $userLogin, $idSites);
+ $this->deleteUserAccess( $userLogin, $idSites);
// delete UserAccess
$db = Zend_Registry::get('db');
@@ -485,9 +485,9 @@ class Piwik_UsersManager_API
* @param string user login
* @exception if the user doesn't exist
*/
- static private function checkUserExists( $userLogin )
+ private function checkUserExists( $userLogin )
{
- if(!self::userExists($userLogin))
+ if(!$this->userExists($userLogin))
{
throw new Exception(Piwik_TranslateException("UsersManager_ExceptionUserDoesNotExist", $userLogin));
}
@@ -499,22 +499,22 @@ class Piwik_UsersManager_API
* @param string user email
* @exception if the user doesn't exist
*/
- static private function checkUserEmailExists( $userEmail )
+ private function checkUserEmailExists( $userEmail )
{
- if(!self::userEmailExists($userEmail))
+ if(!$this->userEmailExists($userEmail))
{
throw new Exception(Piwik_TranslateException("UsersManager_ExceptionUserDoesNotExist", $userEmail));
}
}
- static private function checkUserIsNotAnonymous( $userLogin )
+ private function checkUserIsNotAnonymous( $userLogin )
{
if($userLogin == 'anonymous')
{
throw new Exception(Piwik_TranslateException("UsersManager_ExceptionEditAnonymous"));
}
}
- static private function checkUserIsNotSuperUser( $userLogin )
+ private function checkUserIsNotSuperUser( $userLogin )
{
if($userLogin == Zend_Registry::get('config')->superuser->login)
{
@@ -522,7 +522,7 @@ class Piwik_UsersManager_API
}
}
- static private function checkAccessType($access)
+ private function checkAccessType($access)
{
$accessList = Piwik_Access::getListAccess();
@@ -542,7 +542,7 @@ class Piwik_UsersManager_API
* @param string the user login.
*
*/
- static private function deleteUserOnly( $userLogin )
+ private function deleteUserOnly( $userLogin )
{
$db = Zend_Registry::get('db');
$db->query("DELETE FROM ".Piwik::prefixTable("user")." WHERE login = ?", $userLogin);
@@ -558,7 +558,7 @@ class Piwik_UsersManager_API
*
* @return bool true on success
*/
- static private function deleteUserAccess( $userLogin, $idSites = null )
+ private function deleteUserAccess( $userLogin, $idSites = null )
{
$db = Zend_Registry::get('db');
@@ -586,7 +586,7 @@ class Piwik_UsersManager_API
* @param string Login
* @param string MD5ied string of the password
*/
- static public function getTokenAuth($userLogin, $md5Password)
+ public function getTokenAuth($userLogin, $md5Password)
{
if(strlen($md5Password) != 32)
{
@@ -602,7 +602,7 @@ class Piwik_UsersManager_API
* @param string email
* @return bool
*/
- static private function isValidPasswordString( $input )
+ private function isValidPasswordString( $input )
{
$l = strlen($input);
return $l >= 6 && $l <= 26;