summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-12-26 23:47:10 +0100
committermsquare <msquare@notrademark.de>2016-12-26 23:47:10 +0100
commit07a0ed37ec0cd87e6fa3bf23e7baa4c47c87eb0c (patch)
tree64e918e3fc223ac09a77711641dd6d94368c96d1
parent827de98256391606fc7744b302968ee966beda54 (diff)
fix angeltype supporter privilege for signing up users to shift
-rw-r--r--includes/model/Shifts_model.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 8107f707..ed484e1b 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -173,6 +173,18 @@ function Shift_signup_allowed_angel($user, $shift, $angeltype, $user_angeltype,
}
/**
+ * Check if an angeltype supporter can sign up a user to a shift.
+ */
+function Shift_signup_allowed_angeltype_supporter($shift, $angeltype) {
+ $free_entries = Shift_free_entries($shift['SID'], $angeltype['id']);
+ if ($free_entries == 0) {
+ return new ShiftSignupState(ShiftSignupState::OCCUPIED, $free_entries);
+ }
+
+ return new ShiftSignupState(ShiftSignupState::FREE, $free_entries);
+}
+
+/**
* Check if an admin can sign up a user to a shift.
*
* @param Shift $shift
@@ -208,7 +220,7 @@ function Shift_signup_allowed($signup_user, $shift, $angeltype, $user_angeltype
}
if (in_array('shiftentry_edit_angeltype_supporter', $privileges) && User_is_AngelType_supporter($user, $angeltype)) {
- return Shift_signup_allowed_angel($signup_user, $shift, $angeltype, $user_angeltype, $user_shifts, true);
+ return Shift_signup_allowed_angeltype_supporter($shift, $angeltype);
}
return Shift_signup_allowed_angel($signup_user, $shift, $angeltype, $user_angeltype, $user_shifts, false);