Warning messages after module activation and for user with no permission
This commit is contained in:
parent
857454a28d
commit
d777fca0b9
@ -79,6 +79,11 @@ if ($action == 'set' && $user->admin)
|
|||||||
{
|
{
|
||||||
$result=activateModule($value);
|
$result=activateModule($value);
|
||||||
if ($result) setEventMessages($result, null, 'errors');
|
if ($result) setEventMessages($result, null, 'errors');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
||||||
|
setEventMessages($msg, null, 'warnings');
|
||||||
|
}
|
||||||
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1752,3 +1752,5 @@ AddSubstitutions=Add keys substitutions
|
|||||||
DetectionNotPossible=Detection not possible
|
DetectionNotPossible=Detection not possible
|
||||||
UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access)
|
UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access)
|
||||||
ListOfAvailableAPIs=List of available APIs
|
ListOfAvailableAPIs=List of available APIs
|
||||||
|
ModuleEnabledAdminMustCheckRights=Module has been activated. All permissions were given to admin users only.
|
||||||
|
UserHasNoPermissions=This user has no permission defined
|
||||||
@ -1129,6 +1129,10 @@ else
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($res < 0) { dol_print_error($db,$object->error); exit; }
|
if ($res < 0) { dol_print_error($db,$object->error); exit; }
|
||||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||||
|
|
||||||
|
// Check if user has rights
|
||||||
|
$object->getrights();
|
||||||
|
if(empty($object->nb_rights)) setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings');
|
||||||
|
|
||||||
// Connexion ldap
|
// Connexion ldap
|
||||||
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
||||||
|
|||||||
@ -107,6 +107,7 @@ class User extends CommonObject
|
|||||||
var $rights; // Array of permissions user->rights->permx
|
var $rights; // Array of permissions user->rights->permx
|
||||||
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
|
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
|
||||||
private $_tab_loaded=array(); // Array of cache of already loaded permissions
|
private $_tab_loaded=array(); // Array of cache of already loaded permissions
|
||||||
|
var $nb_rights; // Number of rights granted to the user
|
||||||
|
|
||||||
var $conf; // To store personal config
|
var $conf; // To store personal config
|
||||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||||
@ -138,6 +139,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
// For cache usage
|
// For cache usage
|
||||||
$this->all_permissions_are_loaded = 0;
|
$this->all_permissions_are_loaded = 0;
|
||||||
|
$this->nb_rights = 0;
|
||||||
|
|
||||||
// Force some default values
|
// Force some default values
|
||||||
$this->admin = 0;
|
$this->admin = 0;
|
||||||
@ -629,10 +631,12 @@ class User extends CommonObject
|
|||||||
if ($subperms)
|
if ($subperms)
|
||||||
{
|
{
|
||||||
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
|
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
|
||||||
|
if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++;
|
||||||
$this->rights->$module->$perms->$subperms = 1;
|
$this->rights->$module->$perms->$subperms = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(empty($this->rights->$module->$perms)) $this->nb_rights++;
|
||||||
$this->rights->$module->$perms = 1;
|
$this->rights->$module->$perms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,10 +683,12 @@ class User extends CommonObject
|
|||||||
if ($subperms)
|
if ($subperms)
|
||||||
{
|
{
|
||||||
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
|
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
|
||||||
|
if(empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++;
|
||||||
$this->rights->$module->$perms->$subperms = 1;
|
$this->rights->$module->$perms->$subperms = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(empty($this->rights->$module->$perms)) $this->nb_rights++;
|
||||||
$this->rights->$module->$perms = 1;
|
$this->rights->$module->$perms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user