Skip to content
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

Simplifies logic for manage_boards permission giving access to all boards #5472

Conversation

Sesquipedalian
Copy link
Member

@Sesquipedalian Sesquipedalian commented Feb 28, 2019

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:

  1. It's simpler. Instead of needing to use workarounds in the EditBoard2() and EditMembergroup() 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 in build_query_board().
  2. If the permission is later revoked from a membergroup, the group automatically reverts back to whatever board access it had before the permission was given. Under the previous method, if the permission was revoked after the workaround to explicitly grant access to all boards had succeeded, the membergroup would continue to have access to all boards until the admin edited its access.

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.

Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@Sesquipedalian
Copy link
Member Author

@jdarwood007, @Arantor, thoughts?

@Arantor
Copy link
Contributor

Arantor commented Feb 28, 2019

I like it 👍

@Sesquipedalian Sesquipedalian merged commit d7437da into SimpleMachines:release-2.1 Mar 8, 2019
@Sesquipedalian Sesquipedalian deleted the manage_boards_show_all branch March 8, 2019 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants