You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'isolate_parent_query' => false, // Set this to false
115
+
],
116
+
];
99
117
```
100
118
101
-
##Policies
119
+
### Perimeter query isolation
102
120
103
-
In order to be applied to the policy, you need to extend the `ControlledPolicy` class:
121
+
By default the access perimeter's query are isolated from your the other perimeters query, this is to prevent conflict if you manipulate overlayed perimeter.
104
122
105
-
```php
106
-
use Lomkit\Access\Policies\ControlledPolicy;
123
+
If you want to disable this, simply set `queries.isolate_perimeter_queries` in your config file
107
124
108
-
class PostPolicy extends ControlledPolicy
109
-
{
110
-
protected string $model = Post::class;
111
-
}
112
-
```
125
+
```php[access-control.php]
126
+
<?php
113
127
114
-
And you are ready to go, have a look at the [usage section](/essentials/usage) to apply the security wherever you want !
128
+
return [
129
+
'queries' => [
130
+
'isolate_perimeter_queries' => false, // Set this to false
Copy file name to clipboardExpand all lines: content/2.essentials/4.usage.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,12 @@ Post::controlled()
13
13
->get();
14
14
```
15
15
16
+
::info
17
+
When using the query, Access Control will always use the `view` method in the `should` function. This is because it considers you are trying to view models
18
+
since you make a SQL query.
19
+
If you are on an index of a controller, the control might trigger twice, once for `viewAny` (Policy) and once for `view` (Query)
20
+
::
21
+
16
22
## Policies
17
23
18
24
Policies are secured by default for the common method: `viewAny`, `view`, `update`, `create`, `delete`, `restore`, `forceDelete`.
0 commit comments