-
Notifications
You must be signed in to change notification settings - Fork 30
PES-2876, PES-2886: permissions update #365
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
Open
FJiskra
wants to merge
25
commits into
main
Choose a base branch
from
PES-2876_permissions-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3528d15
PES-2876: permissions update
1663a89
PES-2876: permissions update - carrier forms permission check
c09000c
PES-2876: permissions update - Refactor permission checks to use User…
ca0da6e
PES-2876: permissions update - Refactor permission checks to use canU…
ccd48c0
PES-2876: permissions update - Refactor permission checks to use depe…
9a61e79
PES-2886: Add PHPDocs for UserPermissionHelper
Karpec d1983b2
PES-2886: Improve validation logic in UserPermissionHelper
Karpec ba3085a
PES-2886: Refactor UserPermissionHelper to use DbTools for improved q…
Karpec 8c46599
fixup! PES-2886: Refactor UserPermissionHelper to use DbTools for imp…
Karpec 2f901b1
PES-2886: Adjust visibility of constants in UserPermissionHelper for …
Karpec 0660574
PES-2886: Use constants in UserPermissionHelper for better readability
Karpec 15c0bf6
PES-2886: Reformat conditional for readability in packetery.php
Karpec 816206e
PES-2886: Remove unnecessary blank line in PacketeryOrderGridControll…
Karpec 44ca79d
PES-2886: Update conditional to use strict comparison in packetery.php
Karpec 9f31a64
PES-2886: Inject Packetery module into UserPermissionHelper for bette…
Karpec 98cfe56
fixup! PES-2886: Inject Packetery module into UserPermissionHelper fo…
Karpec 5991702
PES-2886: Simplify user permission logic in packetery.php for maintai…
Karpec 76b4611
PES-2886: Move configuration submission handling to ConfigurationForm…
Karpec ebed9fa
fixup! PES-2886: Move configuration submission handling to Configurat…
Karpec 7b003ae
fixup! PES-2886: Refactor UserPermissionHelper to use DbTools for imp…
Karpec c0c90aa
fixup! PES-2886: Reformat conditional for readability in packetery.php
Karpec d1ae744
PES-2886: Extract database query logic to UserPermissionRepository
Karpec 93cf02a
fixup! PES-2886: Extract database query logic to UserPermissionReposi…
Karpec 2e6051e
fixup! fixup! PES-2886: Extract database query logic to UserPermissio…
Karpec a6922a3
PES-2886: Move UserPermissionHelper to a dedicated namespace
Karpec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
31 changes: 31 additions & 0 deletions
31
packetery/controllers/admin/PacketerySettingController.php
This file contains hidden or 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,11 +1,42 @@ | ||
| <?php | ||
|
|
||
| use Packetery\UserPermission\UserPermissionHelper; | ||
|
|
||
| class PacketerySettingController extends ModuleAdminController | ||
| { | ||
| /** @var Packetery */ | ||
| private $packetery; | ||
|
|
||
| public function __construct() | ||
| { | ||
| $this->bootstrap = true; | ||
| $this->context = Context::getContext(); | ||
|
|
||
| parent::__construct(); | ||
| } | ||
|
|
||
| public function initContent() | ||
| { | ||
| $userPermissionHelper = $this->getModule()->diContainer->get(UserPermissionHelper::class); | ||
| if (!$userPermissionHelper->hasPermission(UserPermissionHelper::SECTION_CONFIG, UserPermissionHelper::PERMISSION_VIEW)) { | ||
| $this->errors[] = $this->l('You do not have permission to configure the Packeta module. Access denied.', 'packeterysettingcontroller'); | ||
| return; | ||
| } | ||
|
|
||
| Tools::redirectAdmin( | ||
| $this->module->getAdminLink('AdminModules', ['configure' => $this->module->name, 'tab_module' => $this->module->tab, 'module_name' => $this->module->name]) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * @return Packetery | ||
| */ | ||
| private function getModule() | ||
| { | ||
| if ($this->packetery === null) { | ||
| $this->packetery = new Packetery(); | ||
| } | ||
|
|
||
| return $this->packetery; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proč je tato změna potřeba?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aby se zobrazoval obsah stránky pokud dojde k chybě.