aboutsummaryrefslogtreecommitdiff
path: root/src/Permission.cpp
blob: dc1e9b6b1f78490acd387e9f3cd3ac0aaf61f4be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../include/odhtdb/Permission.hpp"

namespace odhtdb
{
    Permission::Permission(u8 _permissionLevel, u32 _permissionFlags) : 
        permissionLevel(_permissionLevel),
        permissionFlags(_permissionFlags)
    {
        
    }
    
    Permission::Permission(u8 _permissionLevel, std::initializer_list<PermissionType> permissions) : 
        permissionLevel(_permissionLevel)
    {
        permissionFlags = 0;
        for(auto permission : permissions)
        {
            permissionFlags |= (u32)permission;
        }
    }
    
    bool Permission::getFlag(PermissionType permissionType) const
    {
        return (permissionFlags & (u32)permissionType) != 0;
    }
}