summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java
blob: 88ac4842739a5c45cd6559f046b28c76a078aa57 (plain)
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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anjocaido.groupmanager.utils;

import org.anjocaido.groupmanager.data.DataUnit;

/**
 *
 * @author gabrielcouto
 */
public class PermissionCheckResult {

    /**
     * It should be the owner of the access level found.
     *
     * Use instanceof to find the owner type
     */
    public DataUnit owner;
    /**
     * The permission node found in the DataUnit.
     */
    public String accessLevel;
    /**
     * The full name of the permission you are looking for
     */
    public String askedPermission;
    /**
     * The result conclusion of the search.
     * It determines if the owner can do, or not.
     *
     * It even determines if it has an owner.
     */
    public Type resultType = Type.NOTFOUND;

    /**
     * The type of result the search can give.
     */
    public enum Type {

        /**
         * If found a matching node starting with '+'.
         * It means the user CAN do the permission.
         */
        EXCEPTION,
        /**
         * If found a matching node starting with '-'.
         * It means the user CANNOT do the permission.
         */
        NEGATION,
        /**
         * If just found a common matching node.
         * IT means the user CAN do the permission.
         */
        FOUND,
        /**
         * If no matchin node was found.
         * It means the user CANNOT do the permission.
         *
         * owner field and accessLevel field should not be considered,
         * when type is
         * NOTFOUND
         */
        NOTFOUND
    }
}