Convert bitmasks to use left-shift, for easier legibility.
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 7 Apr 2020 11:53:35 +0000 (07:53 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 11 Apr 2020 04:55:36 +0000 (00:55 -0400)
includes/permissions.php

index 5b6a2322386cc1baa3fc4ba8e69c6cc92185dd17..4cdfb365583db3cf13b89d513a289be78a56c9fe 100644 (file)
 \*=====================================================================*/
 
 $bugsys->permissions = array(
-       'canviewbugs'           => 1, // can view bugs
-       'cansearch'                     => 2, // can use the search
-       'cansubscribe'          => 4, // can email subscribe
-       'canvote'                       => 8, // can vote on bugs
-       'cansubmitbugs'         => 16, // can submit new bugs
-       'canpostcomments'       => 32, // can post new comments
-       'cangetattach'          => 64, // can dl attachments
-       'canputattach'          => 128, // can ul attachments
-       'caneditown'            => 256, // can edit own bugs
-       'caneditother'          => 512, // can edit others' bugs
-       'caneditownreply'       => 1024, // can edit own comments
-       'canassign'                     => 2048, // can assign bug
-       'canchangestatus'       => 4096, // can change bug status
-       'canadminpanel'         => 8192, // can view admin panel
-       'canadminbugs'          => 16384, // can administrate bug functions
-       'canadminversions'      => 32768, // can admin version info
-       'canadminusers'         => 65536, // can admin users
-       'canadmingroups'        => 131072, // can admin permission masks
-       'canadmintools'         => 262144, // can use admin tools
-       'canadminfields'        => 524288, // can admin custom bug fields
-       'canbeassignedto'       => 1048576, // can be assigned bugs,
-       'caneditattach'         => 2097152, // can edit attachments
-       'canviewhidden'         => 4194304, // can see hidden bugs
-       'caneditotherreply'     => 8388608, // can edit other peoples' comments
-       'candeletedata'         => 16777216, // can delete data (bugs, comments)
-       'canviewownhidden'      => 33554432 // can view own hidden bugs
+       'canviewbugs'           => 1 << 0, // can view bugs
+       'cansearch'                     => 1 << 1, // can use the search
+       'cansubscribe'          => 1 << 2, // can email subscribe
+       'canvote'                       => 1 << 3, // can vote on bugs
+       'cansubmitbugs'         => 1 << 4, // can submit new bugs
+       'canpostcomments'       => 1 << 5, // can post new comments
+       'cangetattach'          => 1 << 6, // can dl attachments
+       'canputattach'          => 1 << 7, // can ul attachments
+       'caneditown'            => 1 << 8, // can edit own bugs
+       'caneditother'          => 1 << 9, // can edit others' bugs
+       'caneditownreply'       => 1 << 10, // can edit own comments
+       'canassign'                     => 1 << 11, // can assign bug
+       'canchangestatus'       => 1 << 12, // can change bug status
+       'canadminpanel'         => 1 << 13, // can view admin panel
+       'canadminbugs'          => 1 << 14, // can administrate bug functions
+       'canadminversions'      => 1 << 15, // can admin version info
+       'canadminusers'         => 1 << 16, // can admin users
+       'canadmingroups'        => 1 << 17, // can admin permission masks
+       'canadmintools'         => 1 << 18, // can use admin tools
+       'canadminfields'        => 1 << 19, // can admin custom bug fields
+       'canbeassignedto'       => 1 << 20, // can be assigned bugs,
+       'caneditattach'         => 1 << 21, // can edit attachments
+       'canviewhidden'         => 1 << 22, // can see hidden bugs
+       'caneditotherreply'     => 1 << 23, // can edit other peoples' comments
+       'candeletedata'         => 1 << 24, // can delete data (bugs, comments)
+       'canviewownhidden'      => 1 << 25, // can view own hidden bugs
 );
 
 $bugsys->emailoptions = array(
        'relations' => array(
                // a user's relation to the bug
                '-notapplicable-'       => 0, // not applicable
-               'reporter'                      => 1, // report the bug
-               'assignee'                      => 2, // assigned to the bug
-               'favorite'                      => 4, // on the favorites list
-               'voter'                         => 8, // voted for the bug
-               'commenter'                     => 16 // left a comment on the bug
+               'reporter'                      => 1 << 0, // report the bug
+               'assignee'                      => 1 << 1, // assigned to the bug
+               'favorite'                      => 1 << 2, // on the favorites list
+               'voter'                         => 1 << 3, // voted for the bug
+               'commenter'                     => 1 << 4, // left a comment on the bug
        ),
-       
+
        'notifications' => array(
                // notification message types
-               'assignedto'            => 32, // I am made the assignee
-               'statusresolve'         => 64, // status or resolution changes
-               'duplicates'            => 128, // a duplicate bug is added
-               'newcomment'            => 256, // new comment
-               'newattachment'         => 512, // new attachment
-               'otherfield'            => 1024, // any other field changes
-               'newbug'                        => 2048 // new bug
+               'assignedto'            => 1 << 5, // I am made the assignee
+               'statusresolve'         => 1 << 6, // status or resolution changes
+               'duplicates'            => 1 << 7, // a duplicate bug is added
+               'newcomment'            => 1 << 8, // new comment
+               'newattachment'         => 1 << 9, // new attachment
+               'otherfield'            => 1 << 10, // any other field changes
+               'newbug'                        => 1 << 11, // new bug
        )
 );