2021-10-31 21:45:12 +01:00
|
|
|
#ifndef RBAC_RANK_H
|
|
|
|
#define RBAC_RANK_H
|
|
|
|
|
2021-11-01 17:51:54 +01:00
|
|
|
#include "core/string.h"
|
|
|
|
#include "core/containers/vector.h"
|
2021-10-31 21:45:12 +01:00
|
|
|
|
2021-11-01 17:51:54 +01:00
|
|
|
#include "core/resource.h"
|
2021-10-31 21:45:12 +01:00
|
|
|
|
|
|
|
#include "rbac_permission.h"
|
|
|
|
|
2021-11-10 19:35:02 +01:00
|
|
|
class Request;
|
|
|
|
|
2021-10-31 21:45:12 +01:00
|
|
|
class RBACRank : public Resource {
|
|
|
|
RCPP_OBJECT(RBACRank, Resource);
|
|
|
|
|
|
|
|
public:
|
|
|
|
int id;
|
|
|
|
|
2021-11-01 17:51:54 +01:00
|
|
|
String name;
|
|
|
|
String name_internal;
|
|
|
|
String settings;
|
2021-10-31 21:45:12 +01:00
|
|
|
|
2021-11-09 19:58:56 +01:00
|
|
|
int base_permissions;
|
2021-11-01 15:12:09 +01:00
|
|
|
int rank_permissions;
|
|
|
|
|
2021-11-01 17:51:54 +01:00
|
|
|
Vector<Ref<RBACPermission> > permissions;
|
2021-10-31 21:45:12 +01:00
|
|
|
|
2022-01-06 11:34:53 +01:00
|
|
|
Ref<RBACPermission> match_request(Request *request);
|
|
|
|
|
|
|
|
bool get_permissions(Request *request);
|
2021-11-10 19:35:02 +01:00
|
|
|
bool has_permission(Request *request, const int permission);
|
2021-11-10 20:08:42 +01:00
|
|
|
bool has_rank_permission(const int permission);
|
2021-11-10 19:35:02 +01:00
|
|
|
|
2021-11-02 12:26:26 +01:00
|
|
|
void sort_permissions();
|
|
|
|
|
2021-10-31 21:45:12 +01:00
|
|
|
RBACRank();
|
|
|
|
~RBACRank();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|