diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 84cf814a83..489b2bf3f4 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -455,8 +455,12 @@ abstract class User extends cmdbAbstractObject && empty($this->Get('contactid'))) { $this->m_aCheckIssues[] = Dict::S('Class:User/Error:PersonIsMandatory'); } + // Warning if the user has no associated contact + elseif (empty($this->Get('contactid'))) { + $this->AddCheckWarning(Dict::S('Class:User/Warning:NoContactHasImpact')); + } - // Allowed orgs must contains the user org (if any) + // Allowed orgs must contain the user org (if any) if (!empty($this->Get('org_id')) && !UserRights::IsAdministrator($this)) { // Get the user org and all its parent orgs $aUserOrgs = [$this->Get('org_id')]; @@ -485,6 +489,11 @@ abstract class User extends cmdbAbstractObject } } + // Modified User is not administrator and has no allowed orgs, warn about the consequences + if (!UserRights::IsAdministrator($this) && ($this->get('allowed_org_list')->Count() == 0)) { + $this->AddCheckWarning(Dict::S('Class:User/Warning:NoOrganizationMeansFullAccess')); + } + if (!UserRights::IsAdministrator()) { $oUser = UserRights::GetUserObject(); if (!is_null($oUser) && method_exists($oAddon, 'GetUserOrgs')) { diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index 301dc548ad..3be7f8b1c1 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -187,6 +187,8 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:User/Error:OrganizationNotAllowed' => 'Organization not allowed.', 'Class:User/Error:UserOrganizationNotAllowed' => 'The user account does not belong to your allowed organizations.', 'Class:User/Error:PersonIsMandatory' => 'The Contact is mandatory.', + 'Class:User/Warning:NoOrganizationMeansFullAccess' => 'No "Allowed Organizations" defined for this user, this means they have access to all organizations', + 'Class:User/Warning:NoContactHasImpact' => 'Cautious: there is no Person defined on this User, this prevents access to portals, news notifications and other side effects in back-office', 'Class:UserInternal' => 'User Internal', 'Class:UserInternal+' => 'User defined within '.ITOP_APPLICATION_SHORT, )); diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index 098598ccf9..aa046b4bea 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -171,6 +171,8 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Class:User/Error:OrganizationNotAllowed' => 'Organisation non autorisée.', 'Class:User/Error:UserOrganizationNotAllowed' => 'L\'utilisateur n\'appartient pas à vos organisations.', 'Class:User/Error:PersonIsMandatory' => 'Le Contact est obligatoire.', + 'Class:User/Warning:NoOrganizationMeansFullAccess' => 'Aucune "Organisations permises" définie pour cet utilisateur, il aura accès à toutes les organisations sans restriction', + 'Class:User/Warning:NoContactHasImpact' => 'Attention: il n\'y a pas de Personne liée à cet utilisateur, il ne pourra pas se connecter à un portail, ni recevoir de News, ni changer sa langue.', 'Class:UserInternal' => 'Utilisateur interne', 'Class:UserInternal+' => 'Utilisateur défini dans '.ITOP_APPLICATION_SHORT, ));