Skip to content
Snippets Groups Projects

F dot in username

Merged Timm Fitschen requested to merge f-dot-in-username into dev
All threads resolved!
17 files
+ 844
70
Compare changes
  • Side-by-side
  • Inline
Files
17
+ 67
0
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2022 Timm Fitschen <t.fitschen@indiscale.com>
* Copyright (C) 2022 IndiScale GmbH <info@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* @brief PermissionRules grant or deny permissions to roles.
*
* @file caosdb/acm/permission_rule.h
* @author Timm Fitchen
* @date 2022-02-11
*/
#ifndef CAOSDB_ACM_PERMISSION_RULE_H
#define CAOSDB_ACM_PERMISSION_RULE_H
#include <unordered_set> // for unordered_set
#include <string> // for string
namespace caosdb::acm {
class PermissionRuleImpl;
class PermissionRule {
public:
PermissionRule(std::string permission, bool isGrant, bool isPriority);
explicit PermissionRule(PermissionRuleImpl *wrapped);
PermissionRule(const PermissionRule &rule);
auto operator=(const PermissionRule &rule) -> PermissionRule &;
~PermissionRule();
auto ToString() const -> std::string;
[[nodiscard]] auto IsGrant() const -> const bool;
auto SetGrant(bool isGrant) -> void;
[[nodiscard]] auto IsPriority() const -> const bool;
auto SetPriority(bool isPriority) -> void;
[[nodiscard]] auto GetPermission() const -> const std::string &;
auto operator==(const PermissionRule &other) const -> bool;
private:
PermissionRuleImpl *impl;
};
struct HashPermissionRule {
size_t operator()(const PermissionRule& rule) const {
return std::hash<std::string>()(rule.GetPermission());
}
};
using PermissionRules = std::unordered_set<PermissionRule, HashPermissionRule>;
} // namespace caosdb::acm
#endif
Loading