I use a bitmask for access to application and I’ve got an array:
$arr['view_info'] = 2;
$arr['view_terminals'] = 4;
$arr['view_payments'] = 6;
$arr['view_subdealers'] = 8;
$arr['view_providers'] = 10;
$arr['view_users'] = 12;
$arr['view_reports'] = 14;
So, the question is – how can I add permissions, for example – view_terminals and view_reports without permit an access to opts between 4 and 14?
Just the last Q – how to add more than 8 permissions, as I know we have 255 max value in binary sys – so the last one is 128? I’ve heard about groups.
With those values that’s pretty hard to do. Your bitmask values should be powers of 2, i.e. 1, 2, 4, 8, 16, 32, 64, 128, 256 etc. Then you can do
$arr['view_terminals'] | $arr['view_reports'].