These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Access Masks

Author
PsyKzz
Republic Military School
Minmatar Republic
#1 - 2011-09-08 22:47:29 UTC
Can someone explain the maths for me on how to work out the access masks for the api?

Otherwise im tempted to spend some time, work out all the different combinations and just hard code them into an array.

Meh.

Alexis Prey
The Scope
Gallente Federation
#2 - 2011-09-08 22:51:26 UTC
PsyKzz wrote:
Can someone explain the maths for me on how to work out the access masks for the api?

Otherwise im tempted to spend some time, work out all the different combinations and just hard code them into an array.



I have like no idea what they are even for... Can you tell me? I just leave them at w.e they are at
PsyKzz
Republic Military School
Minmatar Republic
#3 - 2011-09-08 22:53:38 UTC
With the customisable access levels on an API key, you have an access mask which is a bitmask to tell you the access available.
For example, i have a key which enables all evemail, except notifications and has an access mask of:
  • 50688

  • I just want to know if their is an easier way to find this out without first knowing.

    Meh.

    Abdiel Kavash
    Deep Core Mining Inc.
    Caldari State
    #4 - 2011-09-08 23:39:48 UTC
    1 AccountBalance
    2 AssetList
    4 CalendarEventAttendees
    8 CharacterSheet
    16 ContactList
    32 ContactNotifications
    64 FacWarStats
    128 IndustryJobs
    256 KillLog
    512 MailBodies
    1024 MailingLists
    2048 MailMessages
    4096 MarketOrders
    8192 Medals
    16384 Notifications
    32768 NotificationTexts
    65536 Research
    131072 SkillInTraining
    262144 SkillQueue
    524288 Standings
    1048576 UpcomingCalendarEvents
    2097152 WalletJournal
    4194304 WalletTransactions
    8388608 CharacterInfo (Public)
    16777216 CharacterInfo (Private)
    33554432 AccountStatus
    67108864 Contracts
    Johnathan Roark
    Quantum Industries
    #5 - 2011-09-09 02:20:19 UTC
    PsyKzz wrote:
    With the customisable access levels on an API key, you have an access mask which is a bitmask to tell you the access available.
    For example, i have a key which enables all evemail, except notifications and has an access mask of:
  • 50688

  • I just want to know if their is an easier way to find this out without first knowing.



    API Call List

    I'm guessing this was left out of the patch notes and blogs. It was posted in one of the cak threads by the devs (too lazy atm to look up where). I had to ask for it so im guessing they forgot about it again :)

    EVEVERIFY - A recruiting API Verification and Audit Tool

    Also try out Yapeal for your php api needs

    Dragonaire
    Here there be Dragons
    #6 - 2011-09-09 03:49:22 UTC
    You can also find a modified version of it in Yapeal. It the UtilAccessMask table.

    Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

    darius mclever
    #7 - 2011-09-09 19:12:09 UTC  |  Edited by: darius mclever
    from http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1572823 :

    Quote:

    Hey all,

    Since the new Api is out I've been updating a small project I've been working on, and thought this might be handy to others. Basically it's an enum in C# (can easily be ported to others) that allows bitwise checking against certain flags.

    [Flags]
    public enum ApiKeyMask
    {
    AccountBalance = 1 << 0,
    AssetList = 1 << 1,
    CalendarEventAttendees = 1 << 2,
    CharacterSheet = 1 << 3,
    ContactList = 1 << 4,
    ContactNotifications = 1 << 5,
    FacWarStats = 1 << 6,
    IndustryJobs = 1 << 7,
    KillLog = 1 << 8,
    MailBodies = 1 << 9,
    MailingLists = 1 << 10,
    MailMessages = 1 << 11,
    MarketOrders = 1 << 12,
    Medals = 1 << 13,
    Notifications = 1 << 14,
    NotificationTexts = 1 << 15,
    Research = 1 << 16,
    SkillInTraining = 1 << 17,
    SkillQueue = 1 << 18,
    Standings = 1 << 19,
    UpcomingCalendarEvents = 1 << 20,
    WalletJournal = 1 << 21,
    WalletTransactions = 1 << 22,
    CharacterInfoPublic = 1 << 23,
    CharacterInfoPrivate = 1 << 24,
    AccountStatus = 1 << 25,
    Contracts = 1 << 26,
    }

    Enjoy :)
    PsyKzz
    Republic Military School
    Minmatar Republic
    #8 - 2011-09-10 02:37:58 UTC
    Im trying to use the following to generate an array of what access the user has.
    Quote:

    foreach ($this->m_callAccessGroups as $bitMask => $_) {
    $remainder = ($this->m_accessmask % $bitMask);
    if ($remainder!=0) { // Has this access.
    $this->m_callAccess[$bitMask]['hasAccess'] = 1;
    } else { $this->m_callAccess[$bitMask]['hasAccess'] = 0; }
    }


    This may just be me with my programming, but could someone explain what i might be doing wrong?

    Meh.

    Vinaeus Stromjor
    #9 - 2011-09-10 03:56:26 UTC
    PsyKzz wrote:
    Im trying to use the following to generate an array of what access the user has.
    Quote:

    foreach ($this->m_callAccessGroups as $bitMask => $_) {
    $remainder = ($this->m_accessmask % $bitMask);
    if ($remainder!=0) { // Has this access.
    $this->m_callAccess[$bitMask]['hasAccess'] = 1;
    } else { $this->m_callAccess[$bitMask]['hasAccess'] = 0; }
    }


    This may just be me with my programming, but could someone explain what i might be doing wrong?


    Hi, I'm not sure what language this is, but make sure you are doing a bitwise "and" with the access mask and bitmask. From the code, it looks like you are doing modulo division.
    TorTorden
    Tors shibari party
    #10 - 2011-09-10 09:40:22 UTC  |  Edited by: TorTorden
    Here's my two cents on the bitmask thing, In short I stuffed the apicalllist.xml into a db table, make an array from it and echoes the api name and description for when the bit evaluation returns true.

    Quote:

    (This is PHP but this forum won't let me post the tags)

    $accessmask=17170696; //The accessmask to test.
    $apikeytype='character'; //if the api is anything but corporation it is a character type key

    $database_connection=/*Make connection to the database*/


    //Fetches the contents of a table made from the apicallList.xml and stuffs it into an array.
    $result=mysql_query("SELECT access_mask,Name,Description FROM apicalllist WHERE Type LIKE '{$apikeytype}'",$database_connection);

    while($row=mysql_fetch_assoc($result))
    {
    $apicalls[$row['access_mask']]['name']=$row['Name'];
    $apicalls[$row['access_mask']]['description']=$row['Description'];
    }


    foreach(array_keys($apicalls) as $key)
    {

    if(($accessmask & $key)==TRUE)
    {
    echo"{$apicalls[$key]['name']} => {$apicalls[$key]['description']} \n\n";
    }

    }


    The sql table can be found here ApiCallList table

    God I miss the code tag.
    PsyKzz
    Republic Military School
    Minmatar Republic
    #11 - 2011-09-10 11:45:02 UTC
    Vinaeus Stromjor wrote:
    PsyKzz wrote:
    Im trying to use the following to generate an array of what access the user has.
    Quote:

    foreach ($this->m_callAccessGroups as $bitMask => $_) {
    $remainder = ($this->m_accessmask % $bitMask);
    if ($remainder!=0) { // Has this access.
    $this->m_callAccess[$bitMask]['hasAccess'] = 1;
    } else { $this->m_callAccess[$bitMask]['hasAccess'] = 0; }
    }


    This may just be me with my programming, but could someone explain what i might be doing wrong?


    Hi, I'm not sure what language this is, but make sure you are doing a bitwise "and" with the access mask and bitmask. From the code, it looks like you are doing modulo division.


    Sorry to clear that up, i was using PHP, after changing from my modulo approach to just doing the bitwise AND it worked.

    The only thing is i dont actually know why?

    Could someone explain?

    nb. My code that got working.
    Quote:

    foreach ($this->m_callAccess as $bitMask => $obj) {
    if (($this->m_accessMask & $bitMask)==TRUE) { // Has this access.
    $this->m_callAccess[$bitMask]['hasAccess'] = 1;
    } else { $this->m_callAccess[$bitMask]['hasAccess'] = 0; }
    }

    Meh.

    TorTorden
    Tors shibari party
    #12 - 2011-09-10 12:26:52 UTC  |  Edited by: TorTorden
    I might be way off but here is how I look at it.

    The access mask isn't a normal number but a string of "yes" "no" bits.
    if the acccesmask for the key gives access to "AccountBallance" (1),"FacWarStats" (64) and "Medals" (8192)
    then the mask should be 8257

    The trick as I understand it is that this translates into binary as " 10000001000001 " (I'm pulling this off the windoze calculator I blame Gates if I'm wrong.)
    the bitwise "AND" test for medals will then look something like

    "Does (8257) 10000001000001 contain the bit for (8192) 10000000000000 ? which is a yes.
    If you would try for the industryjobs (128) it will go like.
    "Does (8257) 10000001000001 contain the bit for (128) 10000000" In this case a no.
    Dragonaire
    Here there be Dragons
    #13 - 2011-09-10 14:40:38 UTC
    I see you've seem to have figured it out but just in case you want to look at someone else's way of handling the bitmaps there a class in Yapeal you'll find in class/util/AccessMask.php that has some nice easy to use methods to go to and from API names and bitmaps. You might want to check them out. You can also look at some of the other classes there to see how I use them.

    Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.