Topic: access levels to new modules / plugins
I had made a plugin but I have problems with access levels
FA version 2.2.8
I have read https://frontaccounting.com/fawiki/index.php?n=Devel.AccessControl
I have a module with access_levels.php with this:
define('SS_MEXCFD', 201<<8);
$security_sections[SS_MEXCFD] = _("MEXCFD (electronic invoices)");
$security_areas['SA_MEXCFD_SETUP'] = array(SS_MEXCFD|1, _("MEXCFD Connector Setup")) ;
$security_areas['SA_MEXCFD_NOTICES'] = array(SS_MEXCFD|2, _("MEXCFD Notices")) ;
/*
201<<8 => 1100100100000000 (51456)
201<<8|1 => 1100100100000001 (51457)
201<<8|2 => 1100100100000010 (51458)
*/
I try to enter my module, setting $page_security = 'SA_MEXCFD_SETUP';
And get an error abput "The security settings on your account do not permit you to access this function"
The role I'm using already have set the permission at Access Setup (I had logout & login again)
In the database the access is stored as 91136, 91236 and 91237
91136 => 10110010000000000
91236 => 10110010001100100
91237 => 10110010001100101
I have found this relation between the permission code (for SA_MEXCFD_SETUP) and the permission set by the access setup:
91236 & 51456 => 16384 => 100000000000000
I don't know if this is the normal behavior or what I have to do in order to use the permission I'm setting in $page_security
I have check also the file current_user.php and the step where it return false is this:
return $code && in_array($code, $this->role_set) && ($this->company == 0 || (($code&~0xff) != SS_SADMIN));
$code = 51457;
in_array($code, $this->role_set) => this return false
$this->role_set contains 91236 instead of 51457;
Could you please advise about this ? Thanks in advance !!