Statistics
| Branch: | Tag: | Revision:

one / include / PoolObjectAuth.h @ 621a1869

History | View | Annotate | Download (2.74 KB)

1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

    
17
#ifndef POOL_OBJECT_AUTH_H_
18
#define POOL_OBJECT_AUTH_H_
19

    
20
#include "PoolObjectSQL.h"
21

    
22
class AclRule;
23

    
24
/**
25
 *  This class abstracts the authorization attributes of a PoolObject. It is
26
 *  used to check permissions and access rights of requests
27
 */
28
class PoolObjectAuth
29
{
30
public:
31
    /* ------------------- Constructor and Methods -------------------------- */
32

    
33
    PoolObjectAuth():
34
        oid(-1),
35
        uid(-1),
36
        gid(-1),
37
        owner_u(1),
38
        owner_m(1),
39
        owner_a(0),
40
        group_u(0),
41
        group_m(0),
42
        group_a(0),
43
        other_u(0),
44
        other_m(0),
45
        other_a(0),
46
        disable_all_acl(false),
47
        disable_cluster_acl(false),
48
        disable_group_acl(false) {};
49

    
50
    void get_acl_rules(AclRule& owner_rule,
51
                       AclRule& group_rule,
52
                       AclRule& other_rule,
53
                       int zone_id) const;
54

    
55
    string type_to_str() const
56
    {
57
        return PoolObjectSQL::type_to_str(obj_type);
58
    };
59

    
60
    /* --------------------------- Attributes ------------------------------- */
61

    
62
    PoolObjectSQL::ObjectType obj_type;
63

    
64
    int oid;
65
    int uid;
66
    int gid;
67
    set<int> cids;
68

    
69
    int owner_u;
70
    int owner_m;
71
    int owner_a;
72

    
73
    int group_u;
74
    int group_m;
75
    int group_a;
76

    
77
    int other_u;
78
    int other_m;
79
    int other_a;
80

    
81
    bool disable_all_acl;     // All objects of this type (e.g. NET/*)
82
    bool disable_cluster_acl; // All objects in a cluster (e.g. NET/%100)
83
    bool disable_group_acl;   // All objects own by this group (e.g. NET/@101)
84
};
85

    
86
#endif /*POOL_OBJECT_AUTH_H_*/