Finalization of the user management by profile (UI to manage the accounts), and some unrelated changes:

- Using class labels in the UI
- Data model: you may specify a set of allowed values from a query (see caller_id in bizIncident class), still not 100% used in the UI but does not generate any error
- Data model: you may specify a password field (AttributePassword replacing AttributeString)
- Setup: calling UserRight::Setup() right after calling UserRight::CreateAdministrator()
- Setup: administrator account created with "my organization" and a dedicated contact
- Menus: optimized the load of std menus (queries written in OQL to get the benefit of the query cache)
- Menus: admin tools, seen only by people having the "admin" profile
- Object edition: fixed bug with the display of N-N links in the form

SVN:trunk[110]
This commit is contained in:
Romain Quetiez
2009-09-04 15:22:40 +00:00
parent e1be74457a
commit 2f26ebe54c
36 changed files with 3112 additions and 2524 deletions

View File

@@ -45,6 +45,8 @@ define('UR_ACTION_APPLICATION_DEFINED', 10000); // Application specific actions
abstract class UserRightsAddOnAPI
{
abstract public function Setup(); // initial installation
abstract public function CreateAdministrator($sAdminUser, $sAdminPwd); // could be used during initial installation
abstract public function Init(); // loads data (possible optimizations)
abstract public function CheckCredentials($sLogin, $sPassword); // returns the id of the user or false
abstract public function GetUserId($sLogin); // returns the id of the user or false
@@ -52,6 +54,7 @@ abstract class UserRightsAddOnAPI
abstract public function IsActionAllowed($iUserId, $sClass, $iActionCode, dbObjectSet $oInstances);
abstract public function IsStimulusAllowed($iUserId, $sClass, $sStimulusCode, dbObjectSet $oInstances);
abstract public function IsActionAllowedOnAttribute($iUserId, $sClass, $sAttCode, $iActionCode, dbObjectSet $oInstances);
abstract public function IsAdministrator($iUserId);
}
@@ -94,6 +97,11 @@ class UserRights
self::$m_iRealUserId = 0;
}
public static function GetModuleInstance()
{
return self::$m_oAddOn;
}
// Installation: create the very first user
public static function CreateAdministrator($sAdminUser, $sAdminPwd)
{
@@ -236,6 +244,20 @@ class UserRights
return self::$m_oAddOn->IsActionAllowedOnAttribute($iUserId, $sClass, $sAttCode, $iActionCode, $oInstances);
}
}
public static function IsAdministrator($iUserId = null)
{
if (!self::CheckLogin()) return false;
if (is_null($iUserId))
{
return self::$m_oAddOn->IsAdministrator(self::$m_iUserId);
}
else
{
return self::$m_oAddOn->IsAdministrator($iUserId);
}
}
}