Link to home
Start Free TrialLog in
Avatar of svfafel
svfafel

asked on

identifying Boolean ANDED hex values

I am working with CDO and one of the enumerated constants is: ACLRIGHTS.  I am trying to parse a value received by the Rights property of an Access Control List.  To make it simple, I am retrieving a value that I need to identify.  The only weird thing is that the Rights property may be a Boolean ANDED value of the following constants:
*********************************************
RIGHTS_EDIT_OWN               0x00000008
RIGHTS_EDIT_ALL               0x00000020
RIGHTS_DELETE_OWN             0x00000010
RIGHTS_DELETE_ALL             0x00000040
RIGHTS_READ_ITEMS             0x00000001
RIGHTS_CREATE_ITEMS           0x00000002
RIGHTS_CREATE_SUBFOLDERS      0x00000080
RIGHTS_FOLDER_OWNER           0x00000100
RIGHTS_FOLDER_CONTACT         0x00000200
RIGHTS_FOLDER_VISIBLE         0x00000400
RIGHTS_NONE                   0x00000000
RIGHTS_ALL                    0x000005fb
ROLE_OWNER                    0x000007fb
ROLE_PUBLISH_EDITOR<          0x000004fb
ROLE_EDITOR                   0x0000047b
ROLE_PUBLISH_AUTHOR           0x0000049b
ROLE_AUTHOR                   0x0000041b
ROLE_NONEDITING_AUTHOR        0x00000413
ROLE_REVIEWER                 0x00000401
ROLE_CONTRIBUTOR              0x00000402
ROLE_NONE                     0x00000400
********************************************

How do i parse the values out?
Avatar of PaulHews
PaulHews
Flag of Canada image

Example

'RIGHTS_EDIT_OWN               0x00000008
Const RIGHTS_EDIT_OWN As Long = &H8

Replace 0x with &H  You can leave in leading zeros as VB will remove them.  
Avatar of Z_Beeblebrox
Z_Beeblebrox

Hi,

If (value AND ROLE_NONE) > 0 then
   'ROLE_NONE is true
Else
   'ROLE_NONE is not true
End if

That will tell you if role_none is true, where value is the enumerated value returned. You need to declare ROLE_NONE as a const as per PaulHews' post.

Zaphod.
Avatar of svfafel

ASKER

Could i pose a hypothetical?  If my value was:

0x00000003 which is:
(RIGHTS_READ_ITEMS 0x00000001)
   AND
(RIGHTS_CREATE_ITEMS 0x00000002)

how would i determine that the 0x00000003 was the read and create rights?
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Furthermore,

if (Value and RIGHTS_READ_ITEMS) then
   ' read rights enabled
end if

if (Value and RIGHTS_CREATE_ITEMS) then
   ' create rights enabled
end if