AUTHORIZED ACTIONS COLUMN IN THE PSAUTHITEM TABLE
1: Add
2: Update Display
3: Add/Update/Display
4: Update/Display All
5: Add/Update/Display All
6: Update/Display/Update/Display All
7: Add/Update/Display/Update/Display All
8: Correction
9: Add/Correction
10: Update/Display / Correction
11: Add/Update/Display/Correction
12: Update/Display All/Correction
13: Add/Update/Display All/Correction
14: Update/Display/Update/Display All/Correction
15: Add/Update/Display/Update/Display All/Correction
128: Data Entry
Each possible authorized action has a corresponding decimal value. For all the authorized actions for a given menu item for a given operator, these numbers are added together and stored in the authorizedactions column.
For example, if the value for authorizedactions column is 143, the operator is authorized for all the actions. (1 2 4 8 128).
As another example, if the value is 7, the operator is authorized for the actions Add, Update/Display, Update/Display All (1 2 4).
---- Following part is not my writing -----------
An example of a number that seems to be too big to be translated is the following:
The number we will use in our example is 3604
This translates to 111000010100 in binary.
We take the lower 8 bits, which will be 00010100
then we use that to convert and find out what authorized actions the user has:
0 0 0 1 0 1 0 0
| | | | | | | -- Add
| | | | | | ---- Update / Display
| | | | | ------ U/D All
| | | | -------- Correction
| | | ----------
| | ------------ > Unused
| -------------- /
---------------- Data Entry
Also i have modifed the query a bit for SQL server as bitAnd does not work for SQL.
select classid, menuname, barname, baritemname, pnlitemname, displayonly,
case when bitand(authorizedactions,1) > 0 then 'Y' else 'N' END ADDACTION,
case when bitand(authorizedactions,2) > 0 then 'Y' else 'N' END UPDATEACTION,
case when bitand(authorizedactions,4) > 0 then 'Y' else 'N' END UPDATEALLACTION,
case when bitand(authorizedactions,8) > 0 then 'Y' else 'N' END CORRECTIONACTION,
case when authorizedactions > 15 then 'Y' else 'N' END SPECIAL
from psauthitem
where classid = 'ALLPAGES'
SELECT CLASSID, MENUNAME, BARNAME, BARITEMNAME, PNLITEMNAME,CASE WHEN (DISPLAYONLY & 1) > 0 THEN 'Y' ELSE 'N' END DISPLAYONLY,
CASE WHEN (cast(AUTHORIZEDACTIONS as int) & 1) > 0 THEN 'Y' ELSE 'N' END ADDACTION,
case when (cast(AUTHORIZEDACTIONS as int) & 2) > 0 then 'Y' else 'N' END UPDATEACTION,
case when (cast(AUTHORIZEDACTIONS as int) & 4) > 0 then 'Y' else 'N' END UPDATEALLACTION,
case when (cast(AUTHORIZEDACTIONS as int) & 8) > 0 then 'Y' else 'N' END CORRECTIONACTION,
CASE WHEN cast(AUTHORIZEDACTIONS as int) > 15 THEN 'Y' ELSE 'N' END SPECIAL
FROM PSAUTHITEM NOLOCK
WHERE CLASSID =