35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
//
|
|
// Created by WolverinDEV on 26/02/2021.
|
|
//
|
|
|
|
#include "./InstanceHandler.h"
|
|
#include "./groups/GroupManager.h"
|
|
#include "./PermissionCalculator.h"
|
|
|
|
using namespace ts;
|
|
using namespace ts::server;
|
|
|
|
permission::v2::PermissionFlaggedValue InstancePermissionHelper::calculate_permission(
|
|
permission::PermissionType permission,
|
|
ClientDbId cldbid,
|
|
ClientType type,
|
|
ChannelId channel,
|
|
bool granted,
|
|
std::shared_ptr<CalculateCache> cache
|
|
) const {
|
|
auto result = this->calculate_permissions({permission}, cldbid, type, channel, granted, cache);
|
|
if(result.empty()) return {0, false};
|
|
return result.front().second;
|
|
}
|
|
|
|
std::vector<std::pair<permission::PermissionType, permission::v2::PermissionFlaggedValue> > InstancePermissionHelper::calculate_permissions(
|
|
const std::deque<permission::PermissionType> &permissions,
|
|
ClientDbId cldbid,
|
|
ClientType type,
|
|
ChannelId channel,
|
|
bool granted,
|
|
std::shared_ptr<CalculateCache> /* cache */
|
|
) const {
|
|
ClientPermissionCalculator calculator{nullptr, cldbid, type, channel};
|
|
return calculator.calculate_permissions(permissions, granted);
|
|
} |