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
Copy file name to clipboardexpand all lines: docs/3.0/authorization.md
+18-13
Original file line number
Diff line number
Diff line change
@@ -541,8 +541,13 @@ end
541
541
```
542
542
</Option>
543
543
544
-
## Implicit authorization
545
-
<Optionname="`implicit_authorization`">
544
+
## Explicit authorization
545
+
546
+
<Optionname="`explicit_authorization`">
547
+
548
+
:::warning Option Renamed
549
+
In versions between <Versionversion="3.13.4" /> and <Versionversion="3.13.6" />, this option is named `implicit_authorization`.
550
+
:::
546
551
547
552
<VersionReqversion="3.13.4" />
548
553
@@ -558,22 +563,22 @@ end
558
563
- If a policy class or method is **missing**, the action will be considered **authorized** by default.
559
564
560
565
**`Proc`**
561
-
- You can also set `implicit_authorization` as a `Proc` to apply custom logic. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)
566
+
- You can also set `explicit_authorization` as a `Proc` to apply custom logic. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)
In this case, missing policies will be handled based on the condition:if the user has access to the admin panel but isn't an admin, the `implicit_authorization` will be enabled. This option allows you to customize authorization decisions based on the context of the current user or other factors.
576
+
In this case, missing policies will be handled based on the condition:if the user has access to the admin panel but isn't an admin, the `explicit_authorization` will be enabled. This option allows you to customize authorization decisions based on the context of the current user or other factors.
572
577
### Default
573
578
574
-
- For **new applications** (starting from Avo `3.13.4`) the default value for `implicit_authorization` is `true`. This provides a more secure out-of-the-box experience by ensuring actions without explicit authorization are denied.
579
+
- For **new applications** (starting from Avo `3.13.4`) the default value for `explicit_authorization` is `true`. This provides a more secure out-of-the-box experience by ensuring actions without explicit authorization are denied.
575
580
576
-
- For **existing applications** upgrading to `3.13.4` or later the default value for `implicit_authorization` remains `false` to preserve backward compatibility. Existing applications will retain the permissive behavior unless explicitly changed.
581
+
- For **existing applications** upgrading to `3.13.4` or later the default value for `explicit_authorization` remains `false` to preserve backward compatibility. Existing applications will retain the permissive behavior unless explicitly changed.
577
582
578
583
### Configuration:
579
584
@@ -583,13 +588,13 @@ You can configure this setting in your `config/avo.rb` file:
583
588
Avo.configure do |config|
584
589
# Set to true to deny access when policies or methods are missing
585
590
# Set to false to allow access when policies or methods are missing
586
-
config.implicit_authorization = true
591
+
config.explicit_authorization = true
587
592
end
588
593
```
589
594
590
595
### Examples:
591
596
592
-
1. **When `implicit_authorization` is `true`**
597
+
1. **When `explicit_authorization` is `true`**
593
598
- **Scenario**: You have a `Post` resource, but there is no policy class defined for it.
594
599
- **Result**: All actions for the `Post` resource (index, show, create, etc.) will be **unauthorized** unless you explicitly define a policy class and methods for those actions.
595
600
@@ -605,7 +610,7 @@ end
605
610
```
606
611
- **Result**: In this case, since the `PostPolicy` lacks an `index?` method, attempting to access the `index` action will be denied by default.
607
612
608
-
2. **When `implicit_authorization: false`**
613
+
2. **When `explicit_authorization: false`**
609
614
- **Scenario**: Same `Post` resource without a policy class.
610
615
- **Result**: All actions for the `Post` resource will be **authorized** even though there are no explicit policy methods. This could expose unintended behavior, as any unprotected action will be accessible.
611
616
@@ -626,13 +631,13 @@ end
626
631
627
632
- **For applications after from Avo `3.13.4`**
628
633
629
-
It is recommended to leave `implicit_authorization` set to `true`, ensuring all actions must be explicitly authorized to prevent unintentional access.
634
+
It is recommended to leave `explicit_authorization` set to `true`, ensuring all actions must be explicitly authorized to prevent unintentional access.
630
635
631
636
- **For applications before from Avo `3.13.4`**
632
637
633
-
- If upgrading from an earlier version, carefully review your policies before enabling `implicit_authorization`. Missing policy methods that were previously allowing access will now deny access unless explicitly defined.
638
+
- If upgrading from an earlier version, carefully review your policies before enabling `explicit_authorization`. Missing policy methods that were previously allowing access will now deny access unless explicitly defined.
634
639
635
-
- It’s recommended to disable [`raise_error_on_missing_policy`](authorization.html#raise-errors-when-policies-are-missing) in production, though it's not mandatory. When`implicit_authorization` is set to `true`, the default behavior is to deny access for actions without a defined policy. In this case, it’s often better to show an unauthorized message to users rather than raise an error. However, keeping [`raise_error_on_missing_policy`](authorization.html#raise-errors-when-policies-are-missing) enabled in development can be helpful for identifying missing policy classes.
640
+
- It’s recommended to disable [`raise_error_on_missing_policy`](authorization.html#raise-errors-when-policies-are-missing) in production, though it's not mandatory. When`explicit_authorization` is set to `true`, the default behavior is to deny access for actions without a defined policy. In this case, it’s often better to show an unauthorized message to users rather than raise an error. However, keeping [`raise_error_on_missing_policy`](authorization.html#raise-errors-when-policies-are-missing) enabled in development can be helpful for identifying missing policy classes.
Copy file name to clipboardexpand all lines: docs/3.0/upgrade.md
+16-3
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,29 @@
3
3
We'll update this page when we release new Avo 3 versions.
4
4
5
5
If you're looking for the Avo 2 to Avo 3 upgrade guide, please visit [the dedicated page](./avo-2-avo-3-upgrade).
6
+
## Upgrade from 3.13.6 to 3.13.7
7
+
8
+
The `implicit_authorization` option has been renamed to `explicit_authorization` to better align with the feature's functionality. The underlying logic remains unchanged, so you only need to perform a rename if you're already using it.
9
+
10
+
```ruby
11
+
config.implicit_authorization =true# [!code --]
12
+
config.explicit_authorization =true# [!code ++]
13
+
```
14
+
6
15
7
16
## Upgrade from 3.13.3 to 3.13.4
8
17
9
18
<Optionname="`implicit_authorization`">
10
19
11
-
We’ve introduced the [`implicit_authorization`](authorization.html#implicit_authorization) configuration option to enhance the security of your applications. This option allows you to define how missing policy classes or methods are handled. When set to `true`, any action without an explicitly defined policy will automatically be denied, ensuring that unprotected actions are not unintentionally accessible. This new behavior offers a more secure approach for authorization.
20
+
:::warning Option Renamed
21
+
<VersionReqversion="3.13.7" /> this option was renamed to `explicit_authorization`.
22
+
:::
23
+
24
+
We’ve introduced the [`implicit_authorization`](authorization.html#explicit_authorization) configuration option to enhance the security of your applications. This option allows you to define how missing policy classes or methods are handled. When set to `true`, any action without an explicitly defined policy will automatically be denied, ensuring that unprotected actions are not unintentionally accessible. This new behavior offers a more secure approach for authorization.
12
25
13
-
For new applications, [`implicit_authorization`](authorization.html#implicit_authorization) is enabled by default, but existing applications will retain the legacy behavior (`false`), allowing missing policies or methods to authorize actions. We encourage you to adopt this new setting by enabling [`implicit_authorization`](authorization.html#implicit_authorization), as it provides greater control over your authorization flow and reduces the risk of unauthorized access due to missing policies. Before enabling it, be sure to review your policy classes to ensure all necessary methods are defined, preventing any unintended access restrictions.
26
+
For new applications, [`implicit_authorization`](authorization.html#explicit_authorization) is enabled by default, but existing applications will retain the legacy behavior (`false`), allowing missing policies or methods to authorize actions. We encourage you to adopt this new setting by enabling [`implicit_authorization`](authorization.html#explicit_authorization), as it provides greater control over your authorization flow and reduces the risk of unauthorized access due to missing policies. Before enabling it, be sure to review your policy classes to ensure all necessary methods are defined, preventing any unintended access restrictions.
14
27
15
-
We highly recommend taking a moment to read through the entire [`implicit_authorization`](authorization.html#implicit_authorization) documentation section before making any changes. Understanding this feature is crucial to ensuring your application's security and functionality, so don’t skip it!
28
+
We highly recommend taking a moment to read through the entire [`implicit_authorization`](authorization.html#explicit_authorization) documentation section before making any changes. Understanding this feature is crucial to ensuring your application's security and functionality, so don’t skip it!
0 commit comments