Hi Forum
This is My new Idea For Page Permission (at least For my self)
in this isue i use Each page Permission versus User Prmission
by this idea U set certain Page access for user as follow
when U create user u set some flags of pages and in each page
the number of page permission will OR with User permission
and if its return 1 then user have access to page see Follow
Think we have at least 8 page (One Byte each page one bit)
0-0-0-0-0-0-0-0
From left to Right -> Page1,page2...Page8
then Page1 permission is 1-0-0-0-0-0-0-0
and page2 permission is 0-1-0-0-0-0-0-0
Page3 Permission is 0-0-1-0-0-0-0-0
.
.
.
page8 permission is 0-0-0-0-0-0-0-1
Ok We want User access to Page2,page5,page6,page8 then
we set flags as Follow
0-1-0-0-1-1-0-1 -> this is User permission(in bit mode)
Now at Top Of Page we Check Permissions as follow
when we make logical OR on this values(make OR on Page permission and User Permission)
it Returns Zero Or one(in logical) and Page will displayed or not
it is very useful when U want to restrict user to certain pages.
Sample:
page permission 00000010
user permission 01101011
(00000010)OR(01101011) = (00000010) -> true (Make bit by bit OR)
=> user have Permission to page
Or Other Sample:
Page permission 00010000
user permission 01101011
(00010000) OR (01101011) = (00000000) -> false user havnt permission to page
and if we have More page we can use Hex mode.
But My Problem is :
How can i make Logical or bit by bit (else its usual compare between True or false)
the Or Operator will return true in this two sample because this
two permision is not zero or null