summaryrefslogtreecommitdiff
path: root/framework/Security
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2015-01-22 09:14:12 +0100
committerFabio Bas <ctrlaltca@gmail.com>2015-01-22 09:14:12 +0100
commit5230f8f8a86fc1ae5d90f8c74ae65c93e197502b (patch)
treee870d29e21c14d5b1683d638dff978afe0a104fa /framework/Security
parent53e4cd65205ac33d7dbc61a767f467c1b896dfc6 (diff)
Apply namespaces to class inheritances (pt1)
Diffstat (limited to 'framework/Security')
-rw-r--r--framework/Security/IUser.php63
-rw-r--r--framework/Security/TAuthManager.php12
-rw-r--r--framework/Security/TAuthorizationRule.php3
-rw-r--r--framework/Security/TAuthorizationRuleCollection.php3
-rw-r--r--framework/Security/TDbUser.php1
-rw-r--r--framework/Security/TDbUserManager.php13
-rw-r--r--framework/Security/TSecurityManager.php5
-rw-r--r--framework/Security/TUser.php8
-rw-r--r--framework/Security/TUserManager.php12
9 files changed, 91 insertions, 29 deletions
diff --git a/framework/Security/IUser.php b/framework/Security/IUser.php
new file mode 100644
index 00000000..fd7db297
--- /dev/null
+++ b/framework/Security/IUser.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Core interfaces essential for TApplication class.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package Prado\Security
+ */
+
+namespace Prado\Security;
+
+/**
+ * IUser interface.
+ *
+ * This interface must be implemented by user objects.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package Prado\Security
+ * @since 3.0
+ */
+interface IUser
+{
+ /**
+ * @return string username
+ */
+ public function getName();
+ /**
+ * @param string username
+ */
+ public function setName($value);
+ /**
+ * @return boolean if the user is a guest
+ */
+ public function getIsGuest();
+ /**
+ * @param boolean if the user is a guest
+ */
+ public function setIsGuest($value);
+ /**
+ * @return array list of roles that the user is of
+ */
+ public function getRoles();
+ /**
+ * @return array|string list of roles that the user is of. If it is a string, roles are assumed by separated by comma
+ */
+ public function setRoles($value);
+ /**
+ * @param string role to be tested
+ * @return boolean whether the user is of this role
+ */
+ public function isInRole($role);
+ /**
+ * @return string user data that is serialized and will be stored in session
+ */
+ public function saveToString();
+ /**
+ * @param string user data that is serialized and restored from session
+ * @return IUser the user object
+ */
+ public function loadFromString($string);
+} \ No newline at end of file
diff --git a/framework/Security/TAuthManager.php b/framework/Security/TAuthManager.php
index be83b695..0e1db884 100644
--- a/framework/Security/TAuthManager.php
+++ b/framework/Security/TAuthManager.php
@@ -10,11 +10,11 @@
*/
namespace Prado\Security;
-
-/**
- * Using IUserManager interface
- */
-Prado::using('System.Security.IUserManager');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\TPropertyValue;
+use Prado\Web\Services\TPageService;
+use Prado\Web\THttpCookie;
/**
* TAuthManager class
@@ -41,7 +41,7 @@ Prado::using('System.Security.IUserManager');
* @package Prado\Security
* @since 3.0
*/
-class TAuthManager extends TModule
+class TAuthManager extends \Prado\TModule
{
/**
* GET variable name for return url
diff --git a/framework/Security/TAuthorizationRule.php b/framework/Security/TAuthorizationRule.php
index ce0835de..6fffbf35 100644
--- a/framework/Security/TAuthorizationRule.php
+++ b/framework/Security/TAuthorizationRule.php
@@ -10,6 +10,7 @@
*/
namespace Prado\Security;
+use Prado\Exceptions\TInvalidDataValueException;
/**
* TAuthorizationRule class
@@ -30,7 +31,7 @@ namespace Prado\Security;
* @package Prado\Security
* @since 3.0
*/
-class TAuthorizationRule extends TComponent
+class TAuthorizationRule extends \Prado\TComponent
{
/**
* @var string action, either 'allow' or 'deny'
diff --git a/framework/Security/TAuthorizationRuleCollection.php b/framework/Security/TAuthorizationRuleCollection.php
index a2356a92..bee3e1fa 100644
--- a/framework/Security/TAuthorizationRuleCollection.php
+++ b/framework/Security/TAuthorizationRuleCollection.php
@@ -10,6 +10,7 @@
*/
namespace Prado\Security;
+use Prado\Exceptions\TInvalidDataTypeException;
/**
* TAuthorizationRuleCollection class.
@@ -20,7 +21,7 @@ namespace Prado\Security;
* @package Prado\Security
* @since 3.0
*/
-class TAuthorizationRuleCollection extends TList
+class TAuthorizationRuleCollection extends \Prado\Collections\TList
{
/**
* @param IUser the user to be authorized
diff --git a/framework/Security/TDbUser.php b/framework/Security/TDbUser.php
index 8b30e0f3..fec4795c 100644
--- a/framework/Security/TDbUser.php
+++ b/framework/Security/TDbUser.php
@@ -10,6 +10,7 @@
*/
namespace Prado\Security;
+use Prado\Data\TDbConnection;
/**
* TDbUser class
diff --git a/framework/Security/TDbUserManager.php b/framework/Security/TDbUserManager.php
index 4d04ece1..93e48159 100644
--- a/framework/Security/TDbUserManager.php
+++ b/framework/Security/TDbUserManager.php
@@ -10,13 +10,10 @@
*/
namespace Prado\Security;
-
-/**
- * Using IUserManager interface
- */
-Prado::using('System.Security.IUserManager');
-Prado::using('System.Data.TDataSourceConfig');
-Prado::using('System.Security.TUser');
+use Prado\Data\TDataSourceConfig;
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidDataTypeException;
+use Prado\Prado;
/**
* TDbUserManager class
@@ -48,7 +45,7 @@ Prado::using('System.Security.TUser');
* @package Prado\Security
* @since 3.1.0
*/
-class TDbUserManager extends TModule implements IUserManager
+class TDbUserManager extends \Prado\TModule implements IUserManager
{
private $_connID='';
private $_conn;
diff --git a/framework/Security/TSecurityManager.php b/framework/Security/TSecurityManager.php
index 57d2f70a..e0239f8e 100644
--- a/framework/Security/TSecurityManager.php
+++ b/framework/Security/TSecurityManager.php
@@ -10,6 +10,9 @@
*/
namespace Prado\Security;
+use Prado\Exceptions\TInvalidDataValueException;
+use Prado\Exceptions\TNotSupportedException;
+use Prado\TPropertyValue;
/**
* TSecurityManager class
@@ -39,7 +42,7 @@ namespace Prado\Security;
* @package Prado\Security
* @since 3.0
*/
-class TSecurityManager extends TModule
+class TSecurityManager extends \Prado\TModule
{
const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey';
const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey';
diff --git a/framework/Security/TUser.php b/framework/Security/TUser.php
index cf89e46f..c30bc6eb 100644
--- a/framework/Security/TUser.php
+++ b/framework/Security/TUser.php
@@ -10,11 +10,7 @@
*/
namespace Prado\Security;
-
-/**
- * Using IUserManager interface
- */
-Prado::using('System.Security.IUserManager');
+use Prado\TPropertyValue;
/**
* TUser class
@@ -31,7 +27,7 @@ Prado::using('System.Security.IUserManager');
* @package Prado\Security
* @since 3.0
*/
-class TUser extends TComponent implements IUser
+class TUser extends \Prado\TComponent implements IUser
{
/**
* @var array persistent state
diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php
index 361f0e5b..1b72c44e 100644
--- a/framework/Security/TUserManager.php
+++ b/framework/Security/TUserManager.php
@@ -10,11 +10,11 @@
*/
namespace Prado\Security;
-
-/**
- * Using TUser class
- */
-Prado::using('System.Security.TUser');
+use Prado\Exceptions\TConfigurationException;
+use Prado\Exceptions\TInvalidOperationException;
+use Prado\TApplication;
+use Prado\TPropertyValue;
+use Prado\Xml\TXmlDocument;
/**
* TUserManager class
@@ -68,7 +68,7 @@ Prado::using('System.Security.TUser');
* @package Prado\Security
* @since 3.0
*/
-class TUserManager extends TModule implements IUserManager
+class TUserManager extends \Prado\TModule implements IUserManager
{
/**
* extension name to the user file