5e011c90fd0f8a23f83fb70c06949526a9c37d39
Stefan Schuermans move most sources into libp...

Stefan Schuermans authored 4 years ago

libpermissioner/src/Permissions.cpp  1) #include <permissioner/Permissions.h>
Stefan Schuermans begin of permissioner confi...

Stefan Schuermans authored 4 years ago

permissionerd/src/Permissions.cpp    2) 
permissionerd/src/Permissions.cpp    3) #include <string>
permissionerd/src/Permissions.cpp    4) 
permissionerd/src/Permissions.cpp    5) void Permissions::parseParams(std::string const &paramStr) {
Stefan Schuermans permission parsing

Stefan Schuermans authored 4 years ago

permissionerd/src/Permissions.cpp    6)   // reset permission flags
permissionerd/src/Permissions.cpp    7)   set = 0;
permissionerd/src/Permissions.cpp    8)   setCond = 0;
permissionerd/src/Permissions.cpp    9)   clear = 0;
permissionerd/src/Permissions.cpp   10)   clearCond = 0;
permissionerd/src/Permissions.cpp   11)   // parse comma-separated groups of [ugoa][+-][rwxX] settings
permissionerd/src/Permissions.cpp   12)   Flags who = 0, what = 0, whatCond = 0;
permissionerd/src/Permissions.cpp   13)   char action = ' ';
permissionerd/src/Permissions.cpp   14)   // append comma at end to process last group
permissionerd/src/Permissions.cpp   15)   for (char c : paramStr + ",") {
permissionerd/src/Permissions.cpp   16)     switch (c) {
permissionerd/src/Permissions.cpp   17)     case ',':
permissionerd/src/Permissions.cpp   18)       switch (action) {
permissionerd/src/Permissions.cpp   19)         case '=':
permissionerd/src/Permissions.cpp   20)           set = who * what;
permissionerd/src/Permissions.cpp   21)           setCond = who * whatCond;
permissionerd/src/Permissions.cpp   22)           clear = who * (what ^ (flagRead | flagWrite | flagExecute));
permissionerd/src/Permissions.cpp   23)           clearCond = who * (what ^ flagExecute);
permissionerd/src/Permissions.cpp   24)           break;
permissionerd/src/Permissions.cpp   25)         case '+':
permissionerd/src/Permissions.cpp   26)           set = who * what;
permissionerd/src/Permissions.cpp   27)           setCond = who * whatCond;
permissionerd/src/Permissions.cpp   28)           break;
permissionerd/src/Permissions.cpp   29)         case '-':
permissionerd/src/Permissions.cpp   30)           clear = who * what;
permissionerd/src/Permissions.cpp   31)           clearCond = who * whatCond;
permissionerd/src/Permissions.cpp   32)           break;
permissionerd/src/Permissions.cpp   33)       }
permissionerd/src/Permissions.cpp   34)       who = 0;
permissionerd/src/Permissions.cpp   35)       what = 0;
permissionerd/src/Permissions.cpp   36)       whatCond = 0;
permissionerd/src/Permissions.cpp   37)       action = ' ';
permissionerd/src/Permissions.cpp   38)       break;
permissionerd/src/Permissions.cpp   39)     case 'u':
permissionerd/src/Permissions.cpp   40)       who |= flagUser;
permissionerd/src/Permissions.cpp   41)       break;
permissionerd/src/Permissions.cpp   42)     case 'g':
permissionerd/src/Permissions.cpp   43)       who |= flagGroup;
permissionerd/src/Permissions.cpp   44)       break;
permissionerd/src/Permissions.cpp   45)     case 'o':
permissionerd/src/Permissions.cpp   46)       who |= flagOther;
permissionerd/src/Permissions.cpp   47)       break;
permissionerd/src/Permissions.cpp   48)     case 'a':
permissionerd/src/Permissions.cpp   49)       who |= flagUser | flagGroup | flagOther;
permissionerd/src/Permissions.cpp   50)       break;
permissionerd/src/Permissions.cpp   51)     case '=':
permissionerd/src/Permissions.cpp   52)     case '+':
permissionerd/src/Permissions.cpp   53)     case '-':
permissionerd/src/Permissions.cpp   54)       action = c;
permissionerd/src/Permissions.cpp   55)       break;
permissionerd/src/Permissions.cpp   56)     case 'r':
permissionerd/src/Permissions.cpp   57)       what |= flagRead;
permissionerd/src/Permissions.cpp   58)       break;
permissionerd/src/Permissions.cpp   59)     case 'w':
permissionerd/src/Permissions.cpp   60)       what |= flagWrite;
permissionerd/src/Permissions.cpp   61)       break;
permissionerd/src/Permissions.cpp   62)     case 'x':
permissionerd/src/Permissions.cpp   63)       what |= flagExecute;
permissionerd/src/Permissions.cpp   64)       break;
permissionerd/src/Permissions.cpp   65)     case 'X':
permissionerd/src/Permissions.cpp   66)       whatCond |= flagExecute;
permissionerd/src/Permissions.cpp   67)       break;
permissionerd/src/Permissions.cpp   68)     }