diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 23c48eb54..e7119189f 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -329,7 +329,14 @@ EOF } } - static function DoLogin($bMustBeAdmin = false) + /** + * Check if the user is already authentified, if yes, then performs some additional validations: + * - if $bMustBeAdmin is true, then the user must be an administrator, otherwise an error is displayed + * - if $bIsAllowedToPortalUsers is false and the user has only access to the portal, then the user is redirected to the portal + * @param bool $bMustBeAdmin Whether or not the user must be an admin to access the current page + * @param bool $bIsAllowedToPortalUsers Whether or not the current page is considered as part of the portal + */ + static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false) { $operation = utils::ReadParam('loginop', ''); session_start(); @@ -392,6 +399,11 @@ EOF $oP->output(); exit; } + elseif ( (!$bIsAllowedToPortalUsers) && (UserRights::IsPortalUser())) + { + // No rights to be here, redirect to the portal + header('Location: ../portal/index.php'); + } } } // End of class diff --git a/application/user.preferences.class.inc.php b/application/user.preferences.class.inc.php index 14a7ed1e4..873c1055d 100644 --- a/application/user.preferences.class.inc.php +++ b/application/user.preferences.class.inc.php @@ -125,14 +125,14 @@ class appUserPreferences extends DBObject { if (self::$oUserPrefs != null) return; $oSearch = new DBObjectSearch('appUserPreferences'); - $oSearch->AddCondition('userid', UserRights::GetUser(), '='); + $oSearch->AddCondition('userid', UserRights::GetUserId(), '='); $oSet = new DBObjectSet($oSearch); $oObj = $oSet->Fetch(); if ($oObj == null) { // No prefs (yet) for this user, create the object $oObj = new appUserPreferences(); - $oObj->Set('userid', UserRights::GetUser()); + $oObj->Set('userid', UserRights::GetUserId()); $oObj->Set('preferences', array()); // Default preferences: an empty array $oObj->DBInsert(); } diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 94e3ff214..0f63306c4 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -529,6 +529,8 @@ class UserRights if (!self::CheckLogin()) return true; if (self::IsAdministrator()) return true; + // Portal users actions are limited by the portal page... + if (self::IsPortalUser()) return true; // this module is forbidden for non admins.... BUT I NEED IT HERE TO DETERMINE USER RIGHTS if (MetaModel::HasCategory($sClass, 'addon/userrights')) return true; diff --git a/dictionaries/dictionary.itop.ui.php b/dictionaries/dictionary.itop.ui.php index a0b45eab5..6e536929c 100644 --- a/dictionaries/dictionary.itop.ui.php +++ b/dictionaries/dictionary.itop.ui.php @@ -39,7 +39,7 @@ // Dict::Add('EN US', 'English', 'English', array( - 'Class:AuditCategory' => 'AuditCategory', + 'Class:AuditCategory' => 'Audit Category', 'Class:AuditCategory+' => 'A section inside the overall audit', 'Class:AuditCategory/Attribute:name' => 'Category Name', 'Class:AuditCategory/Attribute:name+' => 'Short name for this category', @@ -47,6 +47,8 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:AuditCategory/Attribute:description+' => 'Long description for this audit category', 'Class:AuditCategory/Attribute:definition_set' => 'Definition Set', 'Class:AuditCategory/Attribute:definition_set+' => 'OQL expression defining the set of objects to audit', + 'Class:AuditCategory/Attribute:rules_list' => 'Audit Rules', + 'Class:AuditCategory/Attribute:rules_list+' => 'Audit rules for this category', )); // @@ -54,7 +56,7 @@ Dict::Add('EN US', 'English', 'English', array( // Dict::Add('EN US', 'English', 'English', array( - 'Class:AuditRule' => 'AuditRule', + 'Class:AuditRule' => 'Audit Rule', 'Class:AuditRule+' => 'A rule to check for a given Audit category', 'Class:AuditRule/Attribute:name' => 'Rule Name', 'Class:AuditRule/Attribute:name+' => 'Short name for this rule', @@ -788,6 +790,10 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:NotificationsMenu:Actions' => 'Actions', 'UI:NotificationsMenu:AvailableActions' => 'Available actions', + 'Menu:AuditCategories' => 'Audit Categories', + 'Menu:AuditCategories+' => 'Audit Categories', + 'Menu:Notifications:Title' => 'Audit Categories', + 'Menu:RunQueriesMenu' => 'Run Queries', 'Menu:RunQueriesMenu+' => 'Run any query', @@ -829,6 +835,25 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:PasswordConfirm' => '(Confirm)', 'UI:BeforeAdding_Class_ObjectsSaveThisObject' => 'Before adding more %1$s objects, save this object.', 'UI:DisplayThisMessageAtStartup' => 'Display this message at startup', + + 'Portal:Title' => 'iTop user portal', + 'Portal:Refresh' => 'Refresh', + 'Portal:Back' => 'Back', + 'Portal:CreateNewRequest' => 'Create a new request', + 'Portal:ChangeMyPassword' => 'Change my password', + 'Portal:Disconnect' => 'Disconnect', + 'Portal:OpenRequests' => 'My open requests', + 'Portal:ResolvedRequests' => 'My resolved requests', + 'Portal:SelectService' => 'Select a service from the catalog:', + 'Portal:PleaseSelectOneService' => 'Please select one service', + 'Portal:SelectSubcategoryFrom_Service' => 'Select a sub-category for the service %1$s:', + 'Portal:PleaseSelectAServiceSubCategory' => 'Please select one sub-category', + 'Portal:DescriptionOfTheRequest' => 'Enter the description of your request:', + 'Portal:TitleRequestDetailsFor_Request' => 'Details for request %1$s:', + 'Portal:NoOpenRequest' => 'No request in this category.', + 'Portal:Button:CloseTicket' => 'Close this ticket', + 'Portal:EnterYourCommentsOnTicket' => 'Enter your comments about the resolution of this ticket:', + 'Portal:ErrorNoContactForThisUser' => 'Error: the current user is not associated with a Contact/Person. Please contact your administrator.', )); diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index ebaae475e..896fbf2ee 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -47,6 +47,8 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:AuditCategory/Attribute:description+' => 'Description', 'Class:AuditCategory/Attribute:definition_set' => 'Ensemble de définition', 'Class:AuditCategory/Attribute:definition_set+' => 'Expression OQL qui défini le périmètre d\'application de l\'audit', + 'Class:AuditCategory/Attribute:rules_list' => 'Règles d\'audit', + 'Class:AuditCategory/Attribute:rules_list+' => 'Règles d\'audit pour cette catégorie', )); // @@ -802,6 +804,9 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé 'UI:NotificationsMenu:Actions' => 'Actions', 'UI:NotificationsMenu:AvailableActions' => 'Actions existantes', + 'Menu:AuditCategories' => 'Catégories d\'audit', + 'Menu:AuditCategories+' => 'Catégories d\'audit', + 'Menu:Notifications:Title' => 'Catégories d\'audit', 'Menu:RunQueriesMenu' => 'Requêtes OQL', 'Menu:RunQueriesMenu+' => 'Executer une requête OQL', @@ -840,6 +845,25 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé 'UI:PasswordConfirm' => '(Confirmer)', 'UI:BeforeAdding_Class_ObjectsSaveThisObject' => 'Enregistrez l\'objet courant avant de créer de nouveaux éléments de type %1$s.', 'UI:DisplayThisMessageAtStartup' => 'Afficher ce message au démarrage', + + 'Portal:Title' => 'Portail utilisateur iTop', + 'Portal:Refresh' => 'Rafraîchir', + 'Portal:Back' => 'Retour', + 'Portal:CreateNewRequest' => 'Créer une nouvelle requête', + 'Portal:ChangeMyPassword' => 'Changer mon mot de passe', + 'Portal:Disconnect' => 'Déconnexion', + 'Portal:OpenRequests' => 'Mes requêtes en cours', + 'Portal:ResolvedRequests' => 'Mes requêtes résolues', + 'Portal:SelectService' => 'Choisissez un service dans le catalogue:', + 'Portal:PleaseSelectOneService' => 'Veuillez choisir un service', + 'Portal:SelectSubcategoryFrom_Service' => 'Choisissez une sous-catégorie du service %1$s:', + 'Portal:PleaseSelectAServiceSubCategory' => 'Veuillez choisir une sous-catégorie', + 'Portal:DescriptionOfTheRequest' => 'Entrez la description de votre requête:', + 'Portal:TitleRequestDetailsFor_Request' => 'Détails de votre requête %1$s:', + 'Portal:NoOpenRequest' => 'Aucune requête.', + 'Portal:Button:CloseTicket' => 'Clôre cette requête', + 'Portal:EnterYourCommentsOnTicket' => 'Vos commentaires à propos du traitement de cette requête:', + 'Portal:ErrorNoContactForThisUser' => 'Erreur: l\'utilisateur courant n\'est pas associé à une Personne/Contact. Contactez votre administrateur.', )); ?> diff --git a/images/back.png b/images/back.png new file mode 100644 index 000000000..f0e128b03 Binary files /dev/null and b/images/back.png differ diff --git a/images/logoff.png b/images/logoff.png new file mode 100644 index 000000000..7e1bfb68c Binary files /dev/null and b/images/logoff.png differ diff --git a/images/password.png b/images/password.png new file mode 100644 index 000000000..b9af74b72 Binary files /dev/null and b/images/password.png differ diff --git a/images/refresh.png b/images/refresh.png new file mode 100644 index 000000000..8c04658b7 Binary files /dev/null and b/images/refresh.png differ diff --git a/pages/ajax.render.php b/pages/ajax.render.php index cbd1796da..eb1b4aaef 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -33,7 +33,7 @@ require_once('../application/startup.inc.php'); require_once('../application/user.preferences.class.inc.php'); require_once('../application/loginwebpage.class.inc.php'); -LoginWebPage::DoLogin(); // Check user rights and prompt if needed +LoginWebPage::DoLogin(false /* bMustBeAdmin */, true /* IsAllowedToPortalUsers */); // Check user rights and prompt if needed $oPage = new ajax_page(""); $oPage->no_cache(); diff --git a/pages/logoff.php b/pages/logoff.php index 5f8c2ccd7..0ceef4da6 100644 --- a/pages/logoff.php +++ b/pages/logoff.php @@ -31,7 +31,16 @@ $sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_VERSION); $oPage->add("
\n"); $oPage->add("
\n"); $oPage->add("

".Dict::S('UI:LogOff:ThankYou')."

\n"); -$oPage->add("

".Dict::S('UI:LogOff:ClickHereToLoginAgain')."

"); +$bPortal = utils::ReadParam('portal', false); +if ($bPortal) +{ + $sUrl = '../portal/'; +} +else +{ + $sUrl = '../pages/UI.php'; +} +$oPage->add("

".Dict::S('UI:LogOff:ClickHereToLoginAgain')."

"); $oPage->add("
\n"); $oPage->output(); ?>