Add IfNewHostNotify to DeviceManager
[controller.git] / opendaylight / usermanager / api / src / main / java / org / opendaylight / controller / usermanager / AuthorizationConfig.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.usermanager;
10
11 import java.util.ArrayList;
12 import java.util.Iterator;
13 import java.util.List;
14
15 import org.opendaylight.controller.sal.utils.Status;
16
17 /**
18  * Configuration Java Object which represents a Local configured Authorization
19  * for a remote authenticated user for User Manager.
20  */
21 public class AuthorizationConfig extends UserConfig {
22     private static final long serialVersionUID = 1L;
23
24     public AuthorizationConfig() {
25         super();
26     }
27
28     // Constructor may be needed for autocontainer logic
29     public AuthorizationConfig(String user, List<String> roles) {
30         super();
31         this.user = user;
32         this.roles = (roles == null) ? new ArrayList<String>()
33                 : new ArrayList<String>(roles);
34     }
35
36     @Override
37     public Status validate() {
38         Status status = validateUsername();
39         if (status.isSuccess()) {
40             status = validateRoles();
41         }
42         return status;
43     }
44
45     public String toString() {
46         return "AuthorizationConfig=[user: " + user + ", roles: " + roles + "]";
47     }
48
49     public String getRolesString() {
50         return super.getRolesString();
51     }
52
53 }