82b7727bd1302d15d4831055533ede0c75b1dedc
[clamp.git] / src / main / java / org / onap / clamp / clds / service / CldsUser.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License"); 
9  * you may not use this file except in compliance with the License. 
10  * You may obtain a copy of the License at
11  * 
12  * http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software 
15  * distributed under the License is distributed on an "AS IS" BASIS, 
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
17  * See the License for the specific language governing permissions and 
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * 
22  */
23
24 package org.onap.clamp.clds.service;
25
26 import java.util.Arrays;
27
28 /**
29  * The class represents the CldsUser that can be extracted from cldsusers.json.
30  */
31 public class CldsUser {
32
33     private String user;
34     private String password;
35     private SecureServicePermission[] permissions;
36
37     /**
38      * Returns the user.
39      * 
40      * @return the user
41      */
42     public String getUser() {
43         return user;
44     }
45
46     /**
47      * Sets the user.
48      * 
49      * @param user
50      *            the user to set
51      */
52     public void setUser(String user) {
53         this.user = user;
54     }
55
56     /**
57      * Returns the password.
58      * 
59      * @return the password
60      */
61     public String getPassword() {
62         return password;
63     }
64
65     /**
66      * Sets the password.
67      * 
68      * @param password
69      *            the password to set
70      */
71     public void setPassword(String password) {
72         this.password = password;
73     }
74
75     /**
76      * Returns the permissions.
77      * 
78      * @return the permissions
79      */
80     public SecureServicePermission[] getPermissions() {
81         return Arrays.copyOf(permissions, permissions.length);
82     }
83
84     public String[] getPermissionsString() {
85         return Arrays.stream(getPermissions()).map(SecureServicePermission::getKey).toArray(String[]::new);
86     }
87
88     /**
89      * Sets the permissions.
90      *
91      * @param permissionsArray
92      *            the permissions to set
93      */
94     public void setPermissions(SecureServicePermission[] permissionsArray) {
95         this.permissions = Arrays.copyOf(permissionsArray, permissionsArray.length);
96     }
97 }