def has_user_accepted_licence(self, license_id: int): """ Test to see if the user has accepted the terms of the specified license""" image_license = License.get_by_id(license_id) if image_license in self.accepted_licenses: return True return False
def get_license(license_id: int) -> License: """ Get task from DB :raises: NotFound """ map_license = License.get_by_id(license_id) if map_license is None: raise NotFound() return map_license
def accept_license_terms(self, license_id: int): """ Associate the user in scope with the supplied license """ image_license = License.get_by_id(license_id) self.accepted_licenses.append(image_license) db.session.commit()
def get_all_licenses() -> LicenseListDTO: """ Get all licenses in DB """ return License.get_all()
def create_licence(license_dto: LicenseDTO) -> int: """ Create License in DB """ new_licence_id = License.create_from_dto(license_dto) return new_licence_id