def createUserBase(self, title, isPublic, schema_uid, description=""): """Creates a new UserBase for the current user, given its details. Returns a UserBase object""" db=self.basilic.db self.basilic.ExecSQL(sql.InsertUserBase, (self.uid, isPublic, schema_uid, title, description) ) db.commit() usb_id=sql.getRowId(db,'usb') return UserBase(self, usb_id)
def createRessource(self, tags, value): """Creates a new ressource, cipher the value and insert in DB. Returns ressource UID""" c_value=self.user.crypt_string(str(value)) c2=self.user.decrypt_string(c_value) db=self.basilic.db #res_id, usb_id, res_tags, res_value self.basilic.ExecSQL(sql.InsertRessource, (self.uid, tags, c_value) ) db.commit() usb_id=sql.getRowId(db,'usb')
def createUser(self, login, password, fullname, email): """Creates a new user. Raises an exception if users already exists. Returns usr_id.""" # First create the user secret key ciphered_key=self._createKey(password) # Insert user into DB self.ExecSQL(sql.InsertUser, (login.lower(), password, fullname, email.lower(), ciphered_key) ) self.db.commit() usr_id=sql.getRowId(self.db,'usr') # Returns new user's id return usr_id