aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Access/Role.cpp
blob: 089488e7aba6be8c715e346cbb46c1f15199deff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <Access/Role.h>
#include <base/insertAtEnd.h>


namespace DB
{

bool Role::equal(const IAccessEntity & other) const
{
    if (!IAccessEntity::equal(other))
        return false;
    const auto & other_role = typeid_cast<const Role &>(other);
    return (access == other_role.access) && (granted_roles == other_role.granted_roles) && (settings == other_role.settings);
}

std::vector<UUID> Role::findDependencies() const
{
    std::vector<UUID> res;
    insertAtEnd(res, granted_roles.findDependencies());
    insertAtEnd(res, settings.findDependencies());
    return res;
}

void Role::replaceDependencies(const std::unordered_map<UUID, UUID> & old_to_new_ids)
{
    granted_roles.replaceDependencies(old_to_new_ids);
    settings.replaceDependencies(old_to_new_ids);
}

}