Simplifies logic for manage_boards permission giving access to all boards #5472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5002
Closes #5459
This is an alternative to #5459. This PR continues with the change introduced in 2.1 that meant anyone with the manage_boards permission could see all boards, but also simplifies some logic regarding that behaviour. In particular, these lines in
build_query_board()
now grant anyone who can manage boards access to all boards:https://github.com/SimpleMachines/SMF2.1/blob/1c530f0b0badea95818990ec2665d2c4bdb3ba4a/Sources/Subs.php#L6581-L6582
This approach has two advantages over the previous method:
EditBoard2()
andEditMembergroup()
functions in order to grant access to all boards to membergroups with the permission, this just cuts to the chase by checking for the permission inbuild_query_board()
.In order to address the issue pointed out by @jdarwood007 in #5396 (comment), this PR also adds some logic to the upgrader to remove the manage_boards permission from anyone who doesn't already have access to all boards. So, if the Global Moderator group has the permission on a 2.0.x forum, but does not have access to all boards in the forum, then the permission will be removed during the upgrade to 2.1. However, if the Global Moderator group does already have access to all boards, then it can retain the permission.