3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.authorization;
12 import java.io.Serializable;
15 * Represents the application user role levels
16 * This level has meaning only inside the application context
17 * In the controller space such a role will be seen as <code>APPUSER<code>
18 * as specified in {@link UserLevel}
21 public enum AppRoleLevel implements Serializable {
22 APPADMIN(0, "App-Admin", "Application Administrator"), APPUSER(1,
23 "App-User", "Application User"), APPOPERATOR(2, "App-Operator",
24 "Application Operator"), NOUSER(255, "Unknown User", "Unknown User");
26 private int userLevel;
28 private String prettyLevel;
30 private AppRoleLevel(int userlevel, String level, String prettyLevel) {
31 this.userLevel = userlevel;
33 this.prettyLevel = prettyLevel;
36 public int toNumber() {
37 return this.userLevel;
40 public String toString() {
44 public String toStringPretty() {
45 return this.prettyLevel;
48 public static AppRoleLevel fromString(String levelString) {
49 for (AppRoleLevel rolelevel : AppRoleLevel.values()) {
50 if (rolelevel.toString().equals(levelString)) {