Compare commits

..

No commits in common. "62599898d071d87be0c85543ace128e0c14b9d47" and "eed25f8290768083beeaa29e23ddb4b87491479c" have entirely different histories.

4 changed files with 8 additions and 6 deletions

View File

@ -471,7 +471,7 @@ def invite(current_session: Session):
Route: ``/events/invites`` | Method: ``POST``
POST-data: ``{job: number, invitees: string[], transferee?: string}``
POST-data: ``{job: number, invitees: string[], is_transfer?: boolean}``
Args:
current_session: Session sent with Authorization Header
@ -481,8 +481,10 @@ def invite(current_session: Session):
"""
data = request.get_json()
transferee = data.get("transferee", None)
if transferee is not None and (
transferee != current_session.userid or not current_session.user_.has_permission(permissions.ASSIGN_OTHER)
if (
transferee is not None
and transferee != current_session.userid
and not current_session.user_.has_permission(permissions.ASSIGN_OTHER)
):
raise Forbidden
@ -492,11 +494,11 @@ def invite(current_session: Session):
raise BadRequest
return jsonify(
[
event_controller.invite(job, invitee, current_session.user_, userController.get_user(transferee) if transferee else None)
event_controller.invite(job, invitee, current_session.user_, transferee)
for invitee in [userController.get_user(uid) for uid in data["invitees"]]
]
)
except (TypeError, KeyError, ValueError, NotFound):
except (TypeError, KeyError, ValueError):
raise BadRequest

View File

@ -187,7 +187,7 @@ export const useEventStore = defineStore({
return api.post<FG.Invitation[]>('/events/invitations', {
job: job.id,
invitees: invitees.map((v) => v.userid),
transferee: transferee?.userid,
transferee: transferee,
});
},