Skip to content

Commit

Permalink
feat: 3rd party image legal check
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelvir committed Jul 13, 2024
1 parent 6ff068f commit 1776b90
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions development/manual_db_utils/generate_sample_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def generate_student(idx):
enrolment_status=choice(("enrolled", "early-unenrolled", "pre-enrolled")),
years_in_xamfra=randint(0, 15),
image_agreement=choice((True, False)),
image_agreement_external=choice((True, False)),
)


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pathspec==0.9.0
pdfkit==0.6.1
platformdirs==2.5.2
pluggy==0.13.1
psycopg2==2.9.1
psycopg2-binary==2.9.1
py==1.10.0
pycparser==2.20
pycryptodomex==3.14.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def write_students(students, spamwriter):
student.price_term,
student.gender,
student.image_agreement,
student.image_agreement_external,
student.payment_comments,
student.default_payment_method,
student.dni,
Expand Down
1 change: 1 addition & 0 deletions server/models/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Student(Person):
payment_comments = db.Column(db.Text, nullable=True)
other_comments = db.Column(db.Text, nullable=True)
image_agreement = db.Column(db.Boolean, nullable=False, default=False)
image_agreement_external = db.Column(db.Boolean, nullable=False, default=False)
birth_date = db.Column(db.Date, nullable=True)

enrolment_status = db.Column(db.Text, nullable=False)
Expand Down
4 changes: 4 additions & 0 deletions server/pdfs/templates/enrolment.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ <h5>PAGAMENT | PAGO | PAYMENT</h5>
<br>
{% endif %}

<input {% if student.image_agreement_external %} checked {% endif %} type="checkbox" id="image_permission_external">
<label for="image_permission_external">En cas de matricular-me, autoritzo l’ús de la meva imatge i/o la dels meus fills/es matriculats per a que puguin aparèixer a materials escrits o multimèdia corresponents a activitats organitzades per terceres persones autoritzades per L’ARC Música i sobre la possibilitat de publicar imatges on apareguin clarament identificables els seus fills/es. Aquest material mai podrà ser utilitzat amb finalitats lucratives.</label>
<br>

<input checked type="checkbox" id="p3">
<label for="p3">En qualsevol cas, em comprometo a fer un ús responsable de les imatges obtingudes per mitjans propis de la participació d’alumnes de l’escola a activitats promogudes per aquesta.</label>
<br>
Expand Down
2 changes: 2 additions & 0 deletions server_tests/mothers/student_mother.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def adult_anna() -> dict:
return {
**JsonPersonMother.adult_anna(),
"image_agreement": True,
"image_agreement_external": True,
"country_of_origin": "ES",
"gender": "m",
"birth_date": "2001-01-01",
Expand All @@ -40,6 +41,7 @@ def child_mark(cls) -> dict:
return {
**JsonPersonMother.child_mark(),
"image_agreement": True,
"image_agreement_external": True,
"country_of_origin": "ES",
"gender": "m",
"birth_date": "2005-05-05",
Expand Down
29 changes: 25 additions & 4 deletions web_app/src/PreEnrolmentPage/PreEnrolmentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ __person1__surname1: '',
__person2__email: '', __person2__phone: '', __person2__relation: '',
__person2__is_studying: '', __person2__is_working: '', __person2__career: '',
__person2__education_entity: '', __person2__education_year: '',
image_agreement: false
image_agreement: false,
image_agreement_external: false


},
Expand Down Expand Up @@ -322,7 +323,8 @@ __person1__surname1: '',
is: true,
then: yup.string().required(required)
}),
image_agreement: yup.boolean(required)
image_agreement: yup.boolean(required),
image_agreement_external: yup.boolean(required)
}),
enableReinitialize: true,
onSubmit: (values, {setStatus, setSubmitting}) => {
Expand All @@ -331,6 +333,7 @@ __person1__surname1: '',
let body = {};

body['image_agreement'] = values.image_agreement;
body['image_agreement_external'] = values.image_agreement_external;
body['name'] = values.name;
body['surname1'] = values.surname1;
body['surname2'] = values.surname2;
Expand Down Expand Up @@ -409,7 +412,7 @@ __person1__surname1: '',
['birth_date', 'name', 'surname1', 'surname2', 'address', 'city', 'zip', 'gender', 'is_studying', 'is_working', 'education_entity', 'education_year', 'career', 'years_in_xamfra', 'country_of_origin', 'phone', 'email'],
['__person1__name', '__person1__surname1', '__person1__surname2', '__person1__email', '__person1__phone', '__person1__phone', '__person1__relation', '__person1__is_studying', '__person1__education_entity', '__person1__education_year', '__person1__is_working', '__person1__career'],
['__person2__name', '__person2__surname1', '__person2__surname2', '__person2__email', '__person2__phone', '__person2__phone', '__person2__relation', '__person2__is_studying', '__person2__education_entity', '__person2__education_year', '__person2__is_working', '__person2__career'],
[], [], ['image_agreement'], []];
[], [], ['image_agreement', 'image_agreement_external'], []];

const scrollToTop = () => {
window.scrollTo(0,0);
Expand Down Expand Up @@ -511,7 +514,7 @@ __person1__surname1: '',
<Typography variant={"caption"}>
Enviar aquest formulari implica consentiment per fer ús de les dades per tal de rebre informació durant el període de preinscripció i inici de curs.

La posterior matrícula presencial al centre implica també l'ús de les dades durant tot el curs 2023-2024.
La posterior matrícula presencial al centre implica també l'ús de les dades durant tot el curs 2024-2025.

La nostra política protecció de dades es basa en que:

Expand Down Expand Up @@ -1059,6 +1062,24 @@ La nostra política protecció de dades es basa en que:
"En cas de matricular-lo, autoritzo l’ús de la imatge de l’estudiant, menor d'edat, per a que pugui aparèixer a materials escrits o multimèdia corresponents a activitats educatives organitzades per Xamfrà."
: "En cas de matricular-me, autoritzo l’ús de la meva imatge per a que pugui aparèixer a materials escrits o multimèdia corresponents a activitats educatives organitzades per Xamfrà." }
/>

</Box>
<Box my={2}>
<FormControlLabel
control={
<Checkbox
defaultValue={false}
defaultChecked={false}
checked={formik.values['image_agreement_external']}
name={'image_agreement_external'}
value={formik.values['image_agreement_external']}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
/>
}
key={'image_agreement_external'}
label={"En cas de matricular-me, autoritzo l’ús de la meva imatge i/o la dels meus fills/es matriculats per a que puguin aparèixer a materials escrits o multimèdia corresponents a activitats organitzades per terceres persones autoritzades per L’ARC Música i sobre la possibilitat de publicar imatges on apareguin clarament identificables els seus fills/es. Aquest material mai podrà ser utilitzat amb finalitats lucratives." }
/>
</Box>
<Box textAlign="center">
<ReCAPTCHA sitekey={RECAPTCHA}
Expand Down
11 changes: 10 additions & 1 deletion web_app/src/_components/students.student.attendee.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function Attendee({ children, setNewStudent, addStudentId, newStudent, title, cu
additionalValidation={{
enrolment_status: yup.string().required(t("status_required")),
image_agreement: yup.boolean().required(t("image_required")),
image_agreement_external: yup.boolean().required(t("image_required")),
birth_date: yup.date().required(t("birthdate_required"))
}}
additionalFields={
Expand Down Expand Up @@ -224,7 +225,15 @@ function Attendee({ children, setNewStudent, addStudentId, newStudent, title, cu
select>
<MenuItem value={true}>{t("yes")}</MenuItem>
<MenuItem value={false}>{t("no")}</MenuItem>
</DirtyTextField>
</DirtyTextField>,
<DirtyTextField
label={t("image_agreement_external")}
style={{flex: 1}}
name="image_agreement_external"
select>
<MenuItem value={true}>{t("yes")}</MenuItem>
<MenuItem value={false}>{t("no")}</MenuItem>
</DirtyTextField>
], [<DirtyTextField
label={t("pre_enrolment_date")}
type="date"
Expand Down
1 change: 1 addition & 0 deletions web_app/src/_data/empty_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const emptyAttendee = {...newPerson,
birth_date: null,
other_comments: null,
image_agreement: null,
image_agreement_external: null,
enrolment_status: null,
default_payment_method: null
};
1 change: 1 addition & 0 deletions web_app/src/_translations/locales/cat/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
"status_required": "cal l'estat de matrícula",
"image_required": "cal l'ús d'imatge",
"image_agreement": "ús d'imatge",
"image_agreement_external": "ús d'imatge per tercers",
"cant_remove_schedule": "no es poden eliminar horaris comuns d'un taller",
"continue": "seguir",
"cancelled": "cancelat",
Expand Down
1 change: 1 addition & 0 deletions web_app/src/_translations/locales/eng/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"status_required": "status is required",
"image_required": "image use is required",
"image_agreement": "use of image",
"image_agreement_external": "3rd party use of image",
"cant_remove_schedule": "schedules of a whole course can't be removed",
"continue": "continue",
"cancelled": "cancelled",
Expand Down

0 comments on commit 1776b90

Please sign in to comment.