Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
 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()
Esempio n. 4
0
 def get_all_licenses() -> LicenseListDTO:
     """ Get all licenses in DB """
     return License.get_all()
Esempio n. 5
0
 def create_licence(license_dto: LicenseDTO) -> int:
     """ Create License in DB """
     new_licence_id = License.create_from_dto(license_dto)
     return new_licence_id