This commit is contained in:
WolverinDEV 2020-04-18 11:37:11 +02:00
parent 4b48f2741c
commit 7ebad685b1
6 changed files with 2499 additions and 2499 deletions

View File

@ -21,7 +21,7 @@ BasicChannel::BasicChannel(ChannelId parentId, ChannelId channelId) {
this->properties()[property::CHANNEL_PID] = parentId;
}
void BasicChannel::setPermissionManager(const std::shared_ptr<permission::v2::PermissionRegister>& manager) {
void BasicChannel::setPermissionManager(const std::shared_ptr<permission::v2::PermissionManager>& manager) {
this->_permissions = manager;
this->update_properties_from_permissions();
}

View File

@ -6,7 +6,7 @@
#include "channel/TreeView.h"
#include "Definitions.h"
#include "Properties.h"
#include "PermissionRegister.h"
#include "PermissionManager.h"
namespace ts {
@ -74,8 +74,8 @@ namespace ts {
return this->permission_granted(permission::i_client_needed_talk_power, granted_value, false);
}
ts_always_inline std::shared_ptr<permission::v2::PermissionRegister> permissions(){ return this->_permissions; }
virtual void setPermissionManager(const std::shared_ptr<permission::v2::PermissionRegister>&);
ts_always_inline std::shared_ptr<permission::v2::PermissionManager> permissions(){ return this->_permissions; }
virtual void setPermissionManager(const std::shared_ptr<permission::v2::PermissionManager>&);
virtual void setProperties(const std::shared_ptr<Properties>&);
private:
ts_always_inline
@ -98,7 +98,7 @@ namespace ts {
protected:
std::weak_ptr<TreeView::LinkedTreeEntry> _link;
std::shared_ptr<Properties> _properties;
std::shared_ptr<permission::v2::PermissionRegister> _permissions;
std::shared_ptr<permission::v2::PermissionManager> _permissions;
ChannelId _channel_order = 0;
ChannelId _channel_id = 0;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
#include <src/License.h>
#include <functional>
#include <src/query/Command.h>
#include "PermissionRegister.h"
#include "PermissionManager.h"
#include "src/query/command_handler.h"
#include "src/query/command_constants.h"

View File

@ -2,14 +2,14 @@
// Created by wolverindev on 15.07.19.
//
#include "PermissionRegister.h"
#include "PermissionManager.h"
#include <iostream>
using namespace std;
using namespace ts::permission::v2;
using PermissionType = ts::permission::PermissionType;
void print_permissions(PermissionRegister& manager) {
void print_permissions(PermissionManager& manager) {
{
auto permissions = manager.permissions();
cout << "Permissions: " << permissions.size() << endl;
@ -22,7 +22,7 @@ void print_permissions(PermissionRegister& manager) {
cout << "Used memory: " << manager.used_memory() << endl;
}
void print_updates(PermissionRegister& manager) {
void print_updates(PermissionManager& manager) {
const auto updates = manager.flush_db_updates();
cout << "Permission updates: " << updates.size() << endl;
for(auto& update : updates) {
@ -40,12 +40,12 @@ Structure size of PermissionManager: 176
Structure size of PermissionContainerBulk<16>: 192
Structure size of PermissionContainer: 12
*/
cout << "Structure size of PermissionManager: " << sizeof(PermissionRegister) << endl;
cout << "Structure size of PermissionManager: " << sizeof(PermissionManager) << endl;
cout << "Structure size of PermissionContainerBulk<16>: " << sizeof(PermissionContainerBulk<16>) << endl;
cout << "Structure size of PermissionContainer: " << sizeof(PermissionContainer) << endl;
cout << "Permissions/bulk: " << PermissionRegister::PERMISSIONS_BULK_ENTRY_COUNT << ". Bulks: " << PermissionRegister::BULK_COUNT << " (Max permissions: " << (PermissionRegister::PERMISSIONS_BULK_ENTRY_COUNT * PermissionRegister::BULK_COUNT) << "; Avl: " << (uint32_t) PermissionType::permission_id_max << ")" << endl;
cout << "Permissions/bulk: " << PermissionManager::PERMISSIONS_BULK_ENTRY_COUNT << ". Bulks: " << PermissionManager::BULK_COUNT << " (Max permissions: " << (PermissionManager::PERMISSIONS_BULK_ENTRY_COUNT * PermissionManager::BULK_COUNT) << "; Avl: " << (uint32_t) PermissionType::permission_id_max << ")" << endl;
PermissionRegister manager{};
PermissionManager manager{};
print_permissions(manager);
manager.set_permission(PermissionType::b_client_ban_ip, {1, 0}, PermissionUpdateType::set_value, PermissionUpdateType::do_nothing);
manager.set_channel_permission(PermissionType::b_client_ban_ip, 2, {1, 0}, PermissionUpdateType::set_value, PermissionUpdateType::do_nothing);