PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Http / Policies / GlobalIntegrationPolicy.php

GlobalIntegrationPolicy.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.14, at app/Http/Policies/GlobalIntegrationPolicy.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Http\Policies;
4
5 use FluentForm\App\Modules\Acl\Acl;
6 use FluentForm\Framework\Foundation\Policy;
7 use FluentForm\Framework\Http\Request\Request;
8
9 class GlobalIntegrationPolicy extends Policy
10 {
11 public function verifyRequest(Request $request)
12 {
13 return $this->canManageGlobalIntegrations();
14 }
15
16 public function index()
17 {
18 return $this->canManageGlobalIntegrations();
19 }
20
21 public function updateIntegration()
22 {
23 return $this->canManageGlobalIntegrations();
24 }
25
26 public function updateModuleStatus()
27 {
28 return $this->canManageGlobalIntegrations();
29 }
30
31 private function canManageGlobalIntegrations()
32 {
33 if (
34 current_user_can('manage_options') ||
35 current_user_can('fluentform_full_access') ||
36 current_user_can('fluentform_settings_manager')
37 ) {
38 return true;
39 }
40
41 $roleCapability = Acl::getCurrentUserCapability();
42
43 // Legacy role-level Fluent Forms access stores the WP role key here.
44 // Granular Fluent Forms permissions must not imply settings access.
45 return $roleCapability && !in_array($roleCapability, Acl::getPermissionSet(), true);
46 }
47 }
48