3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from cmdatahandlers.api import configerror
16 from cmdatahandlers.api import config
18 class Config(config.Config):
19 def __init__(self, confman):
20 super(Config, self).__init__(confman)
21 self.ROOT = 'cloud.users'
31 """ get the users list
39 ConfigError in-case of an error
44 def get_user_password(self, user):
45 """ get the password for a user
49 A string representing the password
53 ConfigError in-case of an error
55 raise configerror.ConfigError('Invalid user %s' % user)
57 def get_admin_user_password(self):
58 """ get the admin user password
62 A string representing the admin user password
66 ConfigError in-case of an error
68 return self.config[self.ROOT]['admin_user_password']
70 def get_admin_user(self):
71 """ get the admin user
75 A string representing the admin user
79 ConfigError in-case of an error
81 return self.config[self.ROOT]['admin_user_name']
83 def get_initial_user_name(self):
84 """ get the initial user name
88 A string representing the initial user name
92 ConfigError in-case of an error
94 return self.config[self.ROOT]['initial_user_name']
96 def get_initial_user_password(self):
97 """ get the initial user password
101 A string representing the initial user password
105 ConfigError in-case of an error
107 return self.config[self.ROOT]['initial_user_password']
109 def mask_sensitive_data(self):
110 self.config[self.ROOT]['admin_user_password'] = self.MASK
111 self.config[self.ROOT]['initial_user_password'] = self.MASK
113 def get_admin_password(self):
114 """ get the admin password
122 ConfigError in-case of an error
124 return self.config[self.ROOT]['admin_password']