Skip to content
Snippets Groups Projects

Release 0.2.0

Closed Timm Fitschen requested to merge release-0.2.0 into main
14 files
+ 46
936
Compare changes
  • Side-by-side
  • Inline

Files

/*
* 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
*/
#ifdef BUILD_ACM
#ifndef CAOSDB_ACM_PERMISSION_RULE_H
#define CAOSDB_ACM_PERMISSION_RULE_H
#include <stddef.h> // for size_t
#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 -> bool;
auto SetGrant(bool isGrant) -> void;
[[nodiscard]] auto IsPriority() 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 {
auto operator()(const PermissionRule &rule) const -> size_t;
};
using PermissionRules = std::unordered_set<PermissionRule, HashPermissionRule>;
} // namespace caosdb::acm
#endif
#endif
Loading