aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yt/core/ytree/permission.h
blob: ec769ee44554e8eca843822e7f526d6765dadc20 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once

#include "public.h"

#include <library/cpp/yt/misc/enum.h>

namespace NYT::NYTree {

////////////////////////////////////////////////////////////////////////////////

//! Defines permissions for various YT objects.
/*!
 *  Each permission corresponds to a unique bit of the mask.
 */
DEFINE_BIT_ENUM(EPermission,
    //! Applies to: all objects
    ((Read)                  (0x0001))

    //! Applies to: tables; same as Read for all other objects
    ((FullRead)              (0x2000))

    //! Applies to: all objects
    ((Write)                 (0x0002))

    //! Applies to: accounts
    ((Use)                   (0x0004))

    //! Applies to: all objects
    ((Administer)            (0x0008))

    //! Applies to: schemas
    ((Create)                (0x0100))

    //! Applies to: all objects
    ((Remove)                (0x0200))

    //! Applies to: tables
    ((Mount)                 (0x0400))

    //! Applies to: operations
    ((Manage)                (0x0800))

    //! Applies to: accounts, pools, composite Cypress nodes
    ((ModifyChildren)        (0x1000))

    //! Applies to: queue-like objects
    ((RegisterQueueConsumer) (0x0010))
);

//! An alias for EPermission denoting bitwise-or of atomic EPermission values.
/*!
 *  No strong type safety is provided.
 *  Use wherever it suits to distinguish permission sets from individual atomic permissions.
 */
using EPermissionSet = EPermission;

const EPermissionSet NonePermissions = EPermissionSet(0x0000);

std::vector<TString> FormatPermissions(EPermissionSet permissions);

////////////////////////////////////////////////////////////////////////////////

//! Describes the set of objects for which permissions must be checked.
DEFINE_BIT_ENUM(EPermissionCheckScope,
    ((None)            (0x0000))
    ((This)            (0x0001))
    ((Parent)          (0x0002))
    ((Descendants)     (0x0004))
);

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NYTree