def create_user (self, user) : patterns.validate_user_name (user) patterns.validate_user_password (password) if user in self.users : raise Exception ((user, password)) self.users.add (user) self.user_passwords[user] = None self.user_emails[user] = None self.user_data[user] = None
def include_user_in_group (self, user, group) : patterns.validate_user_name (user) patterns.validate_group_name (group) if user not in self.users : raise Exception () if group not in self.groups : raise Exception () members = self.group_user_members[group] if user in members : raise Exception () members.add (user)
def include_path_permission_for_user (self, path, user, mode) : path = self.parse_path (path) if user != '*' : patterns.validate_user_name (user) patterns.validate_permission_mode (mode) if user != '*' and user not in self.users : raise Exception () if path not in self.paths : raise Exception () permissions = self.path_user_permissions[path] if user in permissions : raise Exception () permissions[user] = mode
def select_user_data (self, user) : patterns.validate_user_name (user) return self.user_data[user]
def select_user_email (self, user) : patterns.validate_user_name (user) return self.user_emails[user]
def select_user_password (self, user) : patterns.validate_user_name (user) return self.user_passwords[user]
def update_user_data (self, user, data) : patterns.validate_user_name (user) if user not in self.users : raise Exception () self.user_data[user] = data
def update_user_email (self, user, email) : patterns.validate_user_name (user) patterns.validate_email (email) if user not in self.users : raise Exception () self.user_emails[user] = email
def update_user_password (self, user, password) : patterns.validate_user_name (user) patterns.validate_user_password (password) if user not in self.users : raise Exception () self.user_passwords[user] = password