rabarber 5.2.2 → 5.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56f2e8d3ca8eef785029c9a7f42f20b847a15d1a2e057a40ba2bbc9476c16ddd
4
- data.tar.gz: ea63f014aaae04bfaa2cfd25dc9c129a0071f5aadb74d5bdbca6d798b90d09c9
3
+ metadata.gz: 58580c8850cc6cde86318dee64ffcf28bf9daea4ced15eddaf8ff6e0148670bc
4
+ data.tar.gz: 6bd2d216d86d2c30d650cb190f7da17948b693bb9e0f7acd8df0cab2dfdae8ae
5
5
  SHA512:
6
- metadata.gz: 44a7774698408e7e75ccac46732f86090cb16785197947da597ceeb9d50c0a8bf9d43999fb6bf0fa07d8ab44bce52c5183daa0fcd2fcd9e58dbae93a0bd4a174
7
- data.tar.gz: 3b312953e3ec2ab760da6d5e3267c0fcf10697f3981f309772592143a3cc2f0b8bb6eb3c5bccdbdb2a9c3bfb66cdd92cdbb1dc297bcd6397b81d91cb8a5c86ee
6
+ metadata.gz: '085794b488e723adbc08a8b0ec13005cd4352612b452df86ee85364ef3cdbe76288cc0f77d088844b6843134119048d26eb256c8999a0c86cdc0a9505aa5a4eb'
7
+ data.tar.gz: 5c105b394e8984e8f3951c59e2a21b1c96508047a624fd86299ad6471d05d3e4bd6715363ecdf18d845fc6d788f569c7e4d5c6c41cec7cfb75eabaaf754f5d99
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v5.2.3
2
+
3
+ ### Bugs:
4
+
5
+ - Fixed context validation blocking Rails console and database commands when orphaned context classes exist
6
+
1
7
  ## v5.2.2
2
8
 
3
9
  ### Bugs:
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
- # Rabarber: Role-Based Authorization for Rails
1
+ # Rabarber: Simple Role-Based Authorization for Rails
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rabarber.svg)](http://badge.fury.io/rb/rabarber)
4
+ [![Downloads](https://img.shields.io/gem/dt/rabarber.svg)](https://rubygems.org/gems/rabarber)
4
5
  [![Github Actions badge](https://github.com/enjaku4/rabarber/actions/workflows/ci.yml/badge.svg)](https://github.com/enjaku4/rabarber/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/github/license/enjaku4/rabarber.svg)](LICENSE)
5
7
 
6
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.
7
9
 
@@ -13,6 +15,23 @@ Rabarber is a role-based authorization library for Ruby on Rails that focuses on
13
15
  - Dynamic authorization with conditional logic
14
16
  - View helpers for role-based content rendering
15
17
 
18
+ And this is how your controller might look with Rabarber:
19
+
20
+ ```rb
21
+ class TicketsController < ApplicationController
22
+ grant_access roles: :admin
23
+
24
+ grant_access action: :index, roles: :manager
25
+ def index
26
+ # Accessible to admin and manager roles
27
+ end
28
+
29
+ def destroy
30
+ # Accessible to admin role only
31
+ end
32
+ end
33
+ ```
34
+
16
35
  ## Table of Contents
17
36
 
18
37
  **Gem Usage:**
@@ -4,6 +4,10 @@ require "rails/railtie"
4
4
 
5
5
  module Rabarber
6
6
  class Railtie < Rails::Railtie
7
+ def self.server_running?
8
+ !!defined?(Rails::Server)
9
+ end
10
+
7
11
  def self.table_exists?
8
12
  ActiveRecord::Base.connection.data_source_exists?("rabarber_roles")
9
13
  rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
@@ -12,7 +16,7 @@ module Rabarber
12
16
 
13
17
  initializer "rabarber.to_prepare" do |app|
14
18
  app.config.to_prepare do
15
- if Rabarber::Railtie.table_exists?
19
+ if Rabarber::Railtie.server_running? && Rabarber::Railtie.table_exists?
16
20
  Rabarber::Role.where.not(context_type: nil).distinct.pluck(:context_type).each do |context_class|
17
21
  context_class.constantize
18
22
  rescue NameError => e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabarber
4
- VERSION = "5.2.2"
4
+ VERSION = "5.2.3"
5
5
  end
data/rabarber.gemspec CHANGED
@@ -6,12 +6,16 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "rabarber"
7
7
  spec.version = Rabarber::VERSION
8
8
  spec.authors = ["enjaku4", "trafium"]
9
+ spec.email = ["enjaku4@icloud.com"]
9
10
  spec.homepage = "https://github.com/enjaku4/rabarber"
10
11
  spec.metadata["homepage_uri"] = spec.homepage
11
12
  spec.metadata["source_code_uri"] = spec.homepage
12
13
  spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
14
+ spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
15
+ spec.metadata["documentation_uri"] = "#{spec.homepage}/blob/main/README.md"
13
16
  spec.metadata["rubygems_mfa_required"] = "true"
14
17
  spec.summary = "Simple role-based authorization library for Ruby on Rails"
18
+ spec.description = "Rabarber provides role-based authorization for Ruby on Rails applications with support for multi-tenancy, dynamic rules, and clean controller-level access control that separates authorization from business logic"
15
19
  spec.license = "MIT"
16
20
  spec.required_ruby_version = ">= 3.2", "< 3.5"
17
21
 
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.2
4
+ version: 5.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - enjaku4
@@ -58,6 +58,11 @@ dependencies:
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '8.1'
61
+ description: Rabarber provides role-based authorization for Ruby on Rails applications
62
+ with support for multi-tenancy, dynamic rules, and clean controller-level access
63
+ control that separates authorization from business logic
64
+ email:
65
+ - enjaku4@icloud.com
61
66
  executables: []
62
67
  extensions: []
63
68
  extra_rdoc_files: []
@@ -99,6 +104,8 @@ metadata:
99
104
  homepage_uri: https://github.com/enjaku4/rabarber
100
105
  source_code_uri: https://github.com/enjaku4/rabarber
101
106
  changelog_uri: https://github.com/enjaku4/rabarber/blob/main/CHANGELOG.md
107
+ bug_tracker_uri: https://github.com/enjaku4/rabarber/issues
108
+ documentation_uri: https://github.com/enjaku4/rabarber/blob/main/README.md
102
109
  rubygems_mfa_required: 'true'
103
110
  rdoc_options: []
104
111
  require_paths: