コード例 #1
0
 def delete_user_folder(self, folder, userdb):
     response, err = self.db.delete_userfolder_db(folder, userdb)
     if not err:
         log_message = """action=|database search| method=|delete_user_folder| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to delete folder. It must be empty",
                             500)
コード例 #2
0
 def get_user_group(self, userdb):
     response, err = self.db.get_groups_from_user_db(userdb)
     if not err:
         log_message = """action=|database search| method=|get_user_group| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get groups from user", 500)
     return list(response)
コード例 #3
0
 def get_user_info(self, userdb):
     response, err = self.db.get_user_info_db(userdb)
     if not err:
         log_message = """action=|database search| method=|get_user_info| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get user info password", 500)
     return list(response)
コード例 #4
0
 def search_passwd(self, idUsuario, folder, name):
     response, err = self.db.search_password(idUsuario, folder, name)
     if not err:
         log_message = """action=|database search| method=|search_passwd| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get user info password", 500)
     return list(response)
コード例 #5
0
 def get_pubkey(self, userdb):
     response, err = self.db.get_publickey_db(userdb)
     if not err:
         log_message = """action=|database search| method=|get_pubkey| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get pubkey", 500)
     return list(response)
コード例 #6
0
 def get_groups_name(self, idGrupo):
     response, err = self.db.get_groups_by_id_db(idGrupo)
     if not err:
         log_message = """action=|database search| method=|get_groups_name| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get groups name", 500)
     return list(response)
コード例 #7
0
 def get_group_folder(self, GroupName):
     response, err = self.db.get_groupfolder(GroupName)
     if not err:
         log_message = """action=|database search| method=|get_group_folder| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get group folder", 500)
     return list(response)
コード例 #8
0
 def get_group_passwords_by_folder(self, idFolder, username):
     response, err = self.db.get_group_passwords_byfolder_db(
         idFolder, username)
     if not err:
         log_message = """action=|database search| method=|get_group_passwords_by_folder| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get shared passwords", 500)
     return list(response)
コード例 #9
0
 def update_shared_password(self, _id, name, passwd, description, url,
                            login):
     response, err = self.db.update_shared_password_db(
         _id, name, passwd, description, url, login)
     if not err:
         log_message = """action=|database search| method=|update_shared_password| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to update shared password", 500)
コード例 #10
0
 def add_password_root(self, group, userdb, folder, passwd, name, login,
                       url, description):
     response, err = self.db.add_sharedpassword_special_db(
         group, userdb, folder, passwd, name, login, url, description)
     if not err:
         log_message = """action=|database search| method=|add_password_root| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to add password", 500)
コード例 #11
0
 def get_group_passwords(self, username):
     response, err = self.db.get_group_passwords_db(username)
     if not err:
         log_message = """action=|database search| method=|get_group_passwords| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get password by sharedId", 500)
     if response == None:
         return []
     return list(response)
コード例 #12
0
 def get_passwd_by_sharedId(self, sharedId):
     response, err = self.db.get_passwd_byidCompartilhado(sharedId)
     if not err:
         log_message = """action=|database search| method=|get_passwd_by_sharedId| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get password by sharedId", 500)
     if response == None:
         return []
     return list(response)
コード例 #13
0
 def get_passwd_byid(self, _id):
     response, err = self.db.get_passwd_byid_db(_id)
     if not err:
         log_message = """action=|database search| method=|get_passwd_by_id| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get passwd by id", 500)
     if response == None:
         return []
     return list(response)
コード例 #14
0
 def get_folder_by_name(self, folderName):
     response, err = self.db.get_folderbyname_db(folderName)
     if not err:
         log_message = """action=|database search| method=|get_folder_by_name| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get folder", 500)
     if response == None:
         return []
     return list(response)
コード例 #15
0
 def get_userId_by_group(self, group):
     response, err = self.db.get_usersidbygroup_db(group)
     if not err:
         log_message = """action=|database search| method=|get_userId_by_group| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get users id bu group")
     if response == None:
         return []
     return list(response)
コード例 #16
0
 def get_sharedId(self):
     response, err = self.db.get_idcompartilhados_db()
     if not err:
         log_message = """action=|database search| method=|get_sharedId| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get shared id", 500)
     if response == None:
         return []
     return list(response)
コード例 #17
0
 def update_password_newpubkey(self, idPassword, passwd, nome, login, url,
                               descricao):
     response, err = self.db.update_password_newpubkey(
         idPassword, passwd, nome, login, url, descricao)
     if not err:
         log_message = """action=|database search| method=|update_password_newpubkey| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to update password with new pubkey",
                             500)
コード例 #18
0
 def search_group(self, group):
     response, err = self.db.search_group_db(group)
     if not err:
         log_message = """action=|database search| method=|search_group| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError(response, 500)
     if response == None:
         return []
     return list(response)
コード例 #19
0
 def get_hash(self, userdb):
     response, err = self.db.get_hash(userdb)
     if not err:
         log_message = """action=|database search| method=|get_hash| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get hash", 500)
     if response == None:
         return []
     return list(response)
コード例 #20
0
 def get_group_tree(self, group):
     response, err = self.db.get_groupfolder_tree(group)
     if not err:
         log_message = """action=|database search| method=|get_tree| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get group tree", 500)
     if response == None:
         return []
     return list(response)
コード例 #21
0
 def search_user(self, username):
     response, err = self.db.search_user_db(username)
     if not err:
         log_message = """action=|database search| method=|search user| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to search user", 500)
     if response == None:
         raise InvalidUsage("user does not exist, please add at /add/user",
                            401)
     return list(response)
コード例 #22
0
 def get_pass_by_group_unlock(self, group, userdb, usertounlockdb):
     response, err = self.db.get_pass_by_group_unlock_db(
         group, userdb, usertounlockdb)
     if not err:
         log_message = """action=|database search| method=|get_pass_by_group_unlock| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to get passwords to unlock", 500)
     if response == None:
         return []
     return list(response)
コード例 #23
0
 def add_personal_password(self, username, folderName, passwd, name, login,
                           url, description):
     response, err = self.db.add_personalpassword_db(
         "Personal", username, folderName, passwd, name, login, url,
         description)
     if not err:
         log_message = """action=|database search| method=|add_personal_password| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError(
             "Failed to add personal password. You can not have two passwords with the same name in the same folder",
             400)
コード例 #24
0
    def add_group(self, NomeGrupo):
        groupdb, err = self.db.search_group_db(NomeGrupo)
        if not err:
            log_message = """action=|database search| method=|add_group| desc=|%s| result=|error|""" % groupdb
            self.log.log_error(log_message)
            raise DatabaseError("Failed to search group", 500)

        if groupdb == None:

            response, err = self.db.add_group_db(NomeGrupo)
            if not err:
                log_message = """action=|database search| method=|add_group| desc=|%s| result=|error|""" % response
                self.log.log_error(log_message)
                raise DatabaseError("Failed to add group", 500)

            groupdb, err = self.db.search_group_db(NomeGrupo)
            if not err:
                log_message = """action=|database search| method=|add_group| desc=|%s| result=|error|""" % groupdb
                self.log.log_error(log_message)
                raise DatabaseError("Failed to search group", 500)

            folderName = "/Shared/" + NomeGrupo

            response, err = self.db.add_groupfolder_db(folderName, "/Shared",
                                                       groupdb)
            if not err:
                log_message = """action=|database search| method=|add_group| desc=|%s| result=|error|""" % response
                self.log.log_error(log_message)
                raise DatabaseError("Failed to add group folder", 500)

            externalFolderName = "/Shared/" + NomeGrupo + "/External"
            external_path = "/Shared/" + NomeGrupo

            response, err = self.db.add_groupfolder_db(externalFolderName,
                                                       external_path, groupdb)
            if not err:
                log_message = """action=|database search| method=|add_group_db| desc=|%s| result=|error|""" % response
                self.log.log_error(log_message)
                raise DatabaseError("Failed to add group folder", 500)

        return list(groupdb)
コード例 #25
0
 def add_shared_password(self, group, userdb, folderName, sharedId, passwd,
                         name, login, url, description):
     response, err = self.db.add_sharedpassword_db(group, userdb,
                                                   folderName, sharedId,
                                                   passwd, name, login, url,
                                                   description)
     if not err:
         log_message = """action=|database search| method=|add_shared_password| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError(
             "Failed to add shared password. You can not have two passwords with the same name in the same folder",
             500)
コード例 #26
0
 def exclude_user_group(self, idGrupo, username):
     response, err = self.db.exclude_user_group_db(idGrupo, username)
     if not response:
         log_message = """action=|database search| method=|exclude_user_group| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError(response, 500)
コード例 #27
0
 def set_token(self, userdb, token):
     response, err = self.db.set_token(userdb, token)
     if not err:
         log_message = """action=|database search| method=|set_token| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to set token", 500)
コード例 #28
0
 def add_group_folder(self, folderName, path, group):
     response, err = self.db.add_groupfolder_db(folderName, path, group)
     if not err:
         log_message = """action=|database search| method=|add_group_folder| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to add group folder", 500)
コード例 #29
0
 def update_pubkey(self, userdb, pubkey):
     response, err = self.db.update_publickey(userdb, pubkey)
     if not err:
         log_message = """action=|database search| method=|update_pubkey| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to update pubkey", 500)
コード例 #30
0
 def delete_shared_password(self, _id):
     response, err = self.db.exclude_password_shared_db(_id)
     if not err:
         log_message = """action=|database search| method=|delete_shared_password| desc=|%s| result=|error|""" % response
         self.log.log_error(log_message)
         raise DatabaseError("Failed to delete shared password", 500)