rabarber 5.2.3 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +19 -13
- data/lib/rabarber/version.rb +1 -1
- data/rabarber.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b6af1a1a593e84b481d92883ca7adf385e2ee1fc9a3fb5615818169fc595444
|
|
4
|
+
data.tar.gz: 97738fdc3bb6e3463b8e331088982a4dcd40e62e4251977ee63cc8b742fcb96a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 535dc707a59522461ad3b5bd26d0e394008454c738ff52e84fa6cd7ebfdd26bb441405326563b2ba4a2229008d0ddcf3b6b426dc9d21186896e53aadf99b5fa6
|
|
7
|
+
data.tar.gz: b32d8c3983deb895e7cefe2e3d273cbad0542477c1bad134a7681ac5ae1e390725f7e34b964de4c0f264fcb1b0d21546cb70b7d89ca29cb3c513e831d281c89c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -5,29 +5,35 @@
|
|
|
5
5
|
[](https://github.com/enjaku4/rabarber/actions/workflows/ci.yml)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
Rabarber is a role-based authorization library for Ruby on Rails that focuses on controller-level access control. Rather than answering domain questions like "can this user create a post?", Rabarber answers "can this user access the create post endpoint?", providing a clean separation between authorization and business logic.
|
|
8
|
+
Rabarber is a role-based authorization library for Ruby on Rails that focuses on controller-level access control. Rather than answering domain questions like "can this user create a post?", Rabarber answers "can this user access the create post endpoint?", providing a clean separation between authorization and business logic. It supports multi-tenancy through contextual roles, dynamic authorization with conditional logic, and includes view helpers for role-based content rendering.
|
|
9
9
|
|
|
10
|
-
**
|
|
10
|
+
**Example of Usage:**
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
- Controller-level access control
|
|
14
|
-
- Multi-tenancy support through contextual roles
|
|
15
|
-
- Dynamic authorization with conditional logic
|
|
16
|
-
- View helpers for role-based content rendering
|
|
12
|
+
Consider a CRM system where users with different roles have distinct access levels. For instance, the role `accountant` can interact with invoices but cannot access marketing information, while the role `analyst` has access to marketing-related data. You can define such authorization rules easily with Rabarber.
|
|
17
13
|
|
|
18
|
-
And
|
|
14
|
+
And here's how your controller might look:
|
|
19
15
|
|
|
20
16
|
```rb
|
|
21
|
-
class
|
|
22
|
-
grant_access roles: :admin
|
|
17
|
+
class InvoicesController < ApplicationController
|
|
18
|
+
grant_access roles: :admin # Admin can access everything
|
|
23
19
|
|
|
24
|
-
grant_access action: :index, roles: :
|
|
20
|
+
grant_access action: :index, roles: [:accountant, :analyst]
|
|
25
21
|
def index
|
|
26
|
-
# Accessible to
|
|
22
|
+
# Accessible to both analysts and accountants
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
grant_access action: :show, roles: :accountant
|
|
26
|
+
def show
|
|
27
|
+
# Accessible to accountants
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
grant_access action: :analytics, roles: :analyst
|
|
31
|
+
def analytics
|
|
32
|
+
# Accessible to analysts
|
|
27
33
|
end
|
|
28
34
|
|
|
29
35
|
def destroy
|
|
30
|
-
# Accessible to
|
|
36
|
+
# Accessible to admins only
|
|
31
37
|
end
|
|
32
38
|
end
|
|
33
39
|
```
|
data/lib/rabarber/version.rb
CHANGED
data/rabarber.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rabarber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.2.
|
|
4
|
+
version: 5.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- enjaku4
|
|
@@ -47,7 +47,7 @@ dependencies:
|
|
|
47
47
|
version: '7.1'
|
|
48
48
|
- - "<"
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: '8.
|
|
50
|
+
version: '8.2'
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -57,7 +57,7 @@ dependencies:
|
|
|
57
57
|
version: '7.1'
|
|
58
58
|
- - "<"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '8.
|
|
60
|
+
version: '8.2'
|
|
61
61
|
description: Rabarber provides role-based authorization for Ruby on Rails applications
|
|
62
62
|
with support for multi-tenancy, dynamic rules, and clean controller-level access
|
|
63
63
|
control that separates authorization from business logic
|