-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supplies expected keys in 2nd arg of integrate_load_permissions hook #8036
Supplies expected keys in 2nd arg of integrate_load_permissions hook #8036
Conversation
Fixes SimpleMachines#8007 Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@dragomano, please verify that this fixes the issue. |
You can't forget about self::$permission_groups['membergroup'] either: self::$permission_groups['membergroup'] = &self::$permission_groups['global'];
$permissions_by_scope['membergroup'] = &$permissions_by_scope['global']; However, I'm already just using such a condition in my code: $scope = isset($permissionList['global']) ? 'global' : 'membergroup'; Convenient, and no need to copy arrays :) |
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Oops! Thanks for that.
It's just a reference, not a copy, so I'm not worried about it. FYI, I suggest that you update your code to use the new integrate_permissions_list hook instead. It is the recommended way to work with permissions in SMF 3.0. The integrate_load_permissions, integrate_load_illegal_permissions, and integrate_load_illegal_guest_permissions hooks are now deprecated and will be removed in a future version. |
I've seen the new hook, but it will only work in 3.0, plus show me an example of how to use it to do the same thing I'm doing now. |
Obviously I have not tested the following code, but here is the requested example. Find:
Replace:
Note that this example only shows how to reproduce what you are doing now. However, by using integrate_permissions_list, you could also get access to other functionality that the existing hooks cannot provide. For example, you could set a SMF/Sources/Actions/Admin/Permissions.php Lines 188 to 233 in 655fcfe
|
|
Great, now it works as it should. However, if this hook is not added in 2.1.5, we will still have to wait for 3.0 to be released before using it. And there's a lot more code here than in those 2 previous hooks. |
The new hook will only appear in 3.0. The old hooks will remain available in 3.0, but they will be removed in a future version. You know your own project better than I do, of course, so make your decisions as you see fit. 🙂 |
The same behavior with calendar permissions: 'calendar_edit_own' => [
'generic_name' => 'calendar_edit',
'own_any' => 'own',
'view_group' => 'calendar',
'scope' => 'global',
'group_level' => self::GROUP_LEVEL_MODERATOR,
'never_guests' => true,
],
'calendar_edit_any' => [
'generic_name' => 'calendar_edit',
'own_any' => 'any',
'view_group' => 'calendar',
'scope' => 'global',
'group_level' => self::GROUP_LEVEL_MAINTENANCE,
'never_guests' => true,
], If these permissions are inherently prohibited for assignment to guests, then why is the "Guests" item isn't hidden? |
That would be a bug. |
Fixes #8007