Follow-up from "WIP: Support group based restriction"
The following discussions from !14 (merged) should be addressed:
-
@ip914 started a discussion:
Would it not be sufficient to have
category = SelectField("Category", coerce=str, validators=[DataRequired()])
here?
-
@ip914 started a discussion:
The above would make this code below redundant.
-
@ip914 started a discussion:
Is there any strong reason why we don't want to have the conventional
id
primary key? What does acode
represent? -
@ip914 started a discussion:
Why not having a relationship rather than a plain attribute? Referential integrity is not respected here but maybe that's OK?
-
@ip914 started a discussion:
return bool(self.on_behalf)
-
@ip914 started a discussion:
What if there's no
Person
for the current username? You would get aRuntimeError
-
@ip914 started a discussion:
Same here
-
@ip914 started a discussion:
And here
-
@ip914 started a discussion:
And here too
-
@ip914 started a discussion:
if not project or project.category not in category_codes: can_edit = False
-
@ip914 started a discussion:
And here too
-
@ip914 started a discussion:
Here
-
@ip914 started a discussion:
if not project or project.category not in category_codes: can_view = False
-
@ip914 started a discussion:
Here
-
@ip914 started a discussion:
if not project or project.category not in category_codes: can_shortlist = False
Lots of repetitions in this code. Could we do with less?
In fact, you could get away with a table join between Person and Project (as that's what's happening after all).