-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add permission to access password protected nodes, small refactoring.
- Loading branch information
Showing
10 changed files
with
70 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Andriy | ||
* Date: 25.01.2021 | ||
* Time: 13:55 | ||
* Made with <3 by West from TechGate Studio | ||
*/ | ||
|
||
namespace West\ForumPassword\XF\Pub\Controller; | ||
|
||
|
||
trait ForumPasswordTrait | ||
{ | ||
protected function checkForumPasswordAccess(\West\ForumPassword\XF\Entity\Forum $forum) | ||
{ | ||
if ($forum->wfp_password) | ||
{ | ||
if (\XF::visitor()->hasPermission('general', 'wfpAccessProtectedNodes')) | ||
{ | ||
if (!$forum->isPasswordAccessGranted()) | ||
{ | ||
throw $this->exception( | ||
$this->rerouteController( | ||
'XF:Forum', | ||
'Password', | ||
$forum->toArray() | ||
) | ||
); | ||
} | ||
} | ||
else | ||
{ | ||
throw $this->exception($this->noPermission()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"forum-wfpBypass.json": { | ||
"hash": "a9accb917b5ccdee70cd3edca0a0499e" | ||
}, | ||
"general-wfpAccessProtectedNodes.json": { | ||
"hash": "1732141476333360460c0d3c87d0711f" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"permission_type": "flag", | ||
"interface_group_id": "generalPermissions", | ||
"display_order": 100600, | ||
"depend_permission_id": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[West: Forum Password] Access password protected nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters