Skip to content

Commit 70d7f32

Browse files
committed
doc fixes
1 parent 1be75eb commit 70d7f32

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Use wildcards to allow all actions on a subject or an action on all subjects:
8888

8989
```csharp
9090
var context = new PrivilegeBuilder()
91-
.Allow("test", PrivilegeRule.All) // Allow 'test' action on any subject
92-
.Allow(PrivilegeRule.All, "Post") // Allow any action on 'Post'
91+
.Allow("test", PrivilegeRule.Any) // Allow 'test' action on any subject
92+
.Allow(PrivilegeRule.Any, "Post") // Allow any action on 'Post'
9393
.Forbid("publish", "Post") // Forbid overrides allow
9494
.Build();
9595

@@ -185,8 +185,8 @@ context.Allowed("read", "Post", "content").Should().BeFalse();
185185
Rules are evaluated in the order they are defined, with more specific rules taking precedence:
186186

187187
1. **Forbid rules** always take precedence over allow rules when both match
188-
2. Rules are matched based on exact string comparison (case-insensitive by default)
189-
3. Wildcard rules (`PrivilegeRule.All`, `PrivilegeRule.All`) match any value
188+
2. Rules are matched based on exact string comparison
189+
3. Wildcard rules `PrivilegeRule.Any` match any value
190190
4. Alias expansion happens during rule matching
191191

192192
### String Comparison

src/Privileged/PrivilegeBuilder.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ namespace Privileged;
5050
/// <para>Using wildcard constants for global rules:</para>
5151
/// <code>
5252
/// var context = new PrivilegeBuilder()
53-
/// .Allow("read", PrivilegeRule.All) // Allow reading any subject
54-
/// .Allow(PrivilegeRule.All, "Post") // Allow any action on posts
55-
/// .Forbid("delete", PrivilegeRule.All) // Forbid deleting anything
53+
/// .Allow("read", PrivilegeRule.Any) // Allow reading any subject
54+
/// .Allow(PrivilegeRule.Any, "Post") // Allow any action on posts
55+
/// .Forbid("delete", PrivilegeRule.Any) // Forbid deleting anything
5656
/// .Build();
5757
/// </code>
5858
/// </example>
@@ -180,8 +180,8 @@ public PrivilegeBuilder Comparer(StringComparer comparer)
180180
/// var builder = new PrivilegeBuilder()
181181
/// .Allow("read", "Post") // Basic rule
182182
/// .Allow("edit", "Post", new[] { "title", "content" }) // Rule with qualifiers
183-
/// .Allow(PrivilegeRule.All, "Comment") // Wildcard action
184-
/// .Allow("manage", PrivilegeRule.All); // Wildcard subject
183+
/// .Allow(PrivilegeRule.Any, "Comment") // Wildcard action
184+
/// .Allow("manage", PrivilegeRule.Any); // Wildcard subject
185185
/// </code>
186186
/// </example>
187187
/// <seealso cref="Forbid(string, string, IEnumerable{string}?)"/>
@@ -239,10 +239,10 @@ public PrivilegeBuilder Allow(string action, string subject, IEnumerable<string>
239239
/// <example>
240240
/// <code>
241241
/// var builder = new PrivilegeBuilder()
242-
/// .Allow(PrivilegeRule.All, "Post") // Allow all actions on posts
242+
/// .Allow(PrivilegeRule.Any, "Post") // Allow all actions on posts
243243
/// .Forbid("delete", "Post") // Except deletion
244244
/// .Forbid("edit", "Post", ["sensitive_data"]) // Forbid editing sensitive fields
245-
/// .Forbid(PrivilegeRule.All, "AdminSettings"); // Forbid all actions on admin settings
245+
/// .Forbid(PrivilegeRule.Any, "AdminSettings"); // Forbid all actions on admin settings
246246
/// </code>
247247
/// </example>
248248
/// <seealso cref="Allow(string, string, IEnumerable{string}?)"/>
@@ -383,7 +383,7 @@ public PrivilegeBuilder Merge(PrivilegeModel model)
383383
/// <code>
384384
/// var builder = new PrivilegeBuilder()
385385
/// .Allow("read", "Post")
386-
/// .Forbid("delete", PrivilegeRule.All);
386+
/// .Forbid("delete", PrivilegeRule.Any);
387387
///
388388
/// var context = builder.Build();
389389
///

0 commit comments

Comments
 (0)