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?
**************************
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?
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.
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.
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
if (Value and RIGHTS_READ_ITEMS) then
' read rights enabled
end if
if (Value and RIGHTS_CREATE_ITEMS) then
' create rights enabled
end if
svafel, you abandoned the questions:
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20126403
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20134838
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20148082
https://www.experts-exchange.com/jsp/qShow.jsp?ta=as400&qid=20139402
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20136450
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20148746
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20152319
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20136451
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20142486
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20151411
please clear them up.
cjswimmer
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20126403
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20134838
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20148082
https://www.experts-exchange.com/jsp/qShow.jsp?ta=as400&qid=20139402
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20136450
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20148746
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20152319
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20136451
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20142486
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20151411
please clear them up.
cjswimmer
'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.