Permissions: Fix missing initialization with 0 in some cases

This commit is contained in:
Albert S. 2019-10-02 23:36:30 +02:00
parent 0f6d1abbd5
commit 0a2a943e5b
2 ha cambiato i file con 2 aggiunte e 1 eliminazioni

Vedi File

@ -27,6 +27,7 @@ Permissions::Permissions(int permissions)
Permissions::Permissions(const std::string &str) Permissions::Permissions(const std::string &str)
{ {
this->permissions = 0;
for(auto permission : permmap) for(auto permission : permmap)
{ {
if(str.find(permission.first) != std::string::npos) if(str.find(permission.first) != std::string::npos)

Vedi File

@ -17,7 +17,7 @@
class Permissions class Permissions
{ {
private: private:
int permissions; int permissions = 0;
const std::map<std::string, int> permmap = {{"can_read", PERM_CAN_READ}, const std::map<std::string, int> permmap = {{"can_read", PERM_CAN_READ},
{"can_edit", PERM_CAN_EDIT}, {"can_edit", PERM_CAN_EDIT},
{"can_page_history", PERM_CAN_PAGE_HISTORY}, {"can_page_history", PERM_CAN_PAGE_HISTORY},