Announcement

Collapse
No announcement yet.

bitwise permissions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bitwise permissions

    Not being able to look at any permissions code for the next day, im just curious:

    Where are the permissions stored in vBulletin(the names like CANVIEW or CANADMINPANEL)?

    And i would assume it would be as simple as adding a new permission with an id that is the sum +1 of all entries so far?

    And to check if they have a permission to view the page it would be a simple -> if (CANCUSTOMPERM) { <user can use this code> } ??

    Cheers
    merk

  • #2
    Actually, it isn't as easy as sum+1...

    The first permission is 1, the second 2, the third is 4 and so forth.

    The permissions are parsed in init.php so you can see what they figure out to.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment


    • #3
      Originally posted by Wayne Luke
      Actually, it isn't as easy as sum+1...

      The first permission is 1, the second 2, the third is 4 and so forth.

      The permissions are parsed in init.php so you can see what they figure out to.
      My understanding of those type of permissions is the sum of the existing + 1.

      For example, if you had, 1 ,2 ,4 ,8, the sum of those, adds up to 15, and the next one you would use is 16?

      So the permissions used in vBulletin are hard coded into init.php? (CANVIEW, CANADMINPANEL) ?

      I just cant seem to find anything in the database :\

      Comment


      • #4
        Originally posted by merk
        My understanding of those type of permissions is the sum of the existing + 1.

        For example, if you had, 1 ,2 ,4 ,8, the sum of those, adds up to 15, and the next one you would use is 16?

        So the permissions used in vBulletin are hard coded into init.php? (CANVIEW, CANADMINPANEL) ?

        I just cant seem to find anything in the database :\
        Lookup base 2(binary) math and and logical and operations.

        Comment


        • #5
          Originally posted by Nemon
          Lookup base 2(binary) math and and logical and operations.
          I did that in Yr11, hard to remember, though.

          Comment


          • #6
            Originally posted by merk
            I did that in Yr11, hard to remember, though.
            Same with anything, i've done stuff 10 year ago that if someone asked me about today i wouldn't know where to begin, actually same applys to things i did last week .

            Comment


            • #7
              Originally posted by Nemon
              Same with anything, i've done stuff 10 year ago that if someone asked me about today i wouldn't know where to begin, actually same applys to things i did last week .
              I just looked at init.php (heh went home early )

              I cant see a flaw in my logic of sum+1

              Ill just paste a few lines, hopefully thats not too much of a crime!

              PHP Code:
              $_USEROPTIONS = array(
               
              'showsignatures' => 1,
               
              'showavatars'   => 2,
               
              'showimages'  => 4,
               
              'coppauser'  => 8,
               
              'adminemail'  => 16,
               
              'insouth'  => 32
              Now, adminemail is the sum of everything before it (1 + 2 + 4 + 6) which equals 15, plus 1?

              Ive got the rest of it worked out though, i just have to add more to it.

              And finally another question --> Why isnt this stuff stored in the datbase somewhere? Speed?

              Comment


              • #8
                I guess that would work but it just happens to be exponential Binary technically. If you need to think of it as sum+1 instead of 2 to the nth power then by all means do so.
                Translations provided by Google.

                Wayne Luke
                The Rabid Badger - a vBulletin Cloud demonstration site.
                vBulletin 5 API

                Comment


                • #9
                  Originally posted by Wayne Luke
                  I guess that would work but it just happens to be exponential Binary technically. If you need to think of it as sum+1 instead of 2 to the nth power then by all means do so.
                  Heh, well i guess ill call it 2 to the nth power to make everyone happy

                  Comment

                  Related Topics

                  Collapse

                  Working...
                  X