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
Example #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
 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()