PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
← All changes | app/Services/PermissionManager.php +31 -0 2.1.2 → 2.5.0 View file →
@@ -94,8 +94,29 @@
94 94
95 95 return self::userCan(['manage_all_data', 'manage_other_calendars']);
96 96 }
97 97
98 + /**
99 + * Whether the current user may make $memberIds hosts. Anyone outside $allowedIds
100 + * is someone new being assigned, which is the same act as creating a calendar
101 + * for another user.
102 + *
103 + * @param int[] $memberIds
104 + * @param int[] $allowedIds
105 + * @return bool
106 + */
107 + public static function canAssignHosts($memberIds, $allowedIds)
108 + {
109 + $memberIds = array_map('intval', (array) $memberIds);
110 + $allowedIds = array_map('intval', (array) $allowedIds);
111 +
112 + if (!array_diff($memberIds, $allowedIds)) {
113 + return true;
114 + }
115 +
116 + return self::canManageOtherHosts();
117 + }
118 +
98 119 public static function hasCalendarAccess($calendar)
99 120 {
100 121 $hasAccess = self::userCan('manage_all_data') || $calendar->user_id == get_current_user_id();
101 122
@@ -135,8 +156,18 @@
135 156 }
136 157 }
137 158
138 159 return false;
160 + }
161 +
162 + /**
163 + * Whether the current user may act for, assign or see the details of other hosts.
164 + *
165 + * @return bool
166 + */
167 + public static function canManageOtherHosts()
168 + {
169 + return self::userCan(['manage_all_data', 'invite_team_members']);
139 170 }
140 171
141 172 public static function getUserPermissions($user = null, $formatted = false)
142 173 {