Permission.java 1.23 KB
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fi.insomnia.bortal.enums;

/**
 * 
 * @author tuukka
 */
public enum Permission {

    // NOTE. add conversion Value to RoleRight
    // PERMISSION("Description"),
    LOGIN("User can see loginbutton(r), create new user(w)"),
    USER_MANAGEMENT("User has right to view all users(r), modify users(w), execute actions for user(x), Eg shop! "),
    TICKET_SALES("User has right to view(r), administer(w) and buy(x)"),
    ROLE_MANAGEMENT("User has right to view(r), modify(w) and assign(x) roles"),
    PRODUCT("View(r), modify(w), and shop(x) products"),

    ;
    private String description;

    public static Permission getPermission(String name) {
        if (name == null || name.isEmpty())
            return null;
        try {
            return valueOf(name);
        } catch (IllegalArgumentException x) {
            throw x;
        }
    }

    Permission(String description) {
        this.description = description;
    }

    Permission() {
    }

    public String getName()
    {
        return name();
    }
    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }
}