access_forge-permissions 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/lib/access_forge/permissions/version.rb +1 -1
- data/lib/generators/access_forge/access_groups/access_groups_generator.rb +46 -0
- data/lib/generators/access_forge/access_groups/templates/access_group.rb +8 -0
- data/lib/generators/access_forge/access_groups/templates/access_group_permission.rb +4 -0
- data/lib/generators/access_forge/access_groups/templates/access_group_user.rb +4 -0
- data/lib/generators/access_forge/access_groups/templates/migrations/create_access_group_permissions.rb +11 -0
- data/lib/generators/access_forge/access_groups/templates/migrations/create_access_group_users.rb +11 -0
- data/lib/generators/access_forge/access_groups/templates/migrations/create_access_groups.rb +11 -0
- data/lib/generators/access_forge/access_groups/templates/migrations/create_permissions.rb +10 -0
- data/lib/generators/access_forge/access_groups/templates/permission.rb +7 -0
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa5e73556453d6a607b119e7940db5ead024c7c413b4d63e37826f9b0f055656
|
|
4
|
+
data.tar.gz: cdc6ee945f57ebbe35e285e484291b9a5ab2ffb4608275f3ebecc6c18f4ba671
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dedbf211e66502050166bcfb00a881b92ef68371d149b16cc1c9484c7597a684a69b4ffe3f87dc575db1338eba805e4a7c09f55fe525a5126afdcb8835141f26
|
|
7
|
+
data.tar.gz: 32bae7dad9bf20c24b73875d427344c30c414d2d1fee5456ca689c497a67efbb5176b750e12b1e04832ae4e1e14969f94d6bc82894d4ce22041d81047d8b678f
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require "rails/generators"
|
|
2
|
+
require "rails/generators/named_base"
|
|
3
|
+
require "rails/generators/migration"
|
|
4
|
+
|
|
5
|
+
module AccessForge
|
|
6
|
+
module Generators
|
|
7
|
+
class AccessGroupsGenerator < Rails::Generators::Base
|
|
8
|
+
include Rails::Generators::Migration
|
|
9
|
+
|
|
10
|
+
source_root File.expand_path("templates", __dir__)
|
|
11
|
+
|
|
12
|
+
desc "Creates the necessary models and mirations for access-group authorisation."
|
|
13
|
+
|
|
14
|
+
def create_models
|
|
15
|
+
template "access_group.rb", "app/models/access_group.rb"
|
|
16
|
+
template "permission.rb", "app/models/permission.rb"
|
|
17
|
+
template "access_group_permission.rb", "app/models/access_group_permission.rb"
|
|
18
|
+
template "access_group_user.rb", "app/models/access_group_user.rb"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_migrations
|
|
22
|
+
migration_template "migrations/create_access_groups.rb",
|
|
23
|
+
"db/migrate/create_access_groups.rb"
|
|
24
|
+
|
|
25
|
+
migration_template "migrations/create_permissions.rb",
|
|
26
|
+
"db/migrate/create_permissions.rb"
|
|
27
|
+
|
|
28
|
+
migration_template "migrations/create_access_group_permissions.rb",
|
|
29
|
+
"db/migrate/create_access_group_permissions.rb"
|
|
30
|
+
|
|
31
|
+
migration_template "migrations/create_access_group_users.rb",
|
|
32
|
+
"db/migrate/create_access_group_users.rb"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.next_migration_number(dirname)
|
|
36
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
37
|
+
@@migration_number ||= Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
|
38
|
+
@@migration_number += 1
|
|
39
|
+
@@migration_number.to_s
|
|
40
|
+
else
|
|
41
|
+
format("%03d", current_migration_number(dirname) + 1)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AccessGroup < ApplicationRecord
|
|
2
|
+
has_many :access_group_permissions, inverse_of: :access_group, dependent: :destroy
|
|
3
|
+
has_many :permissions, through: :access_group_permissions
|
|
4
|
+
has_many :access_group_users, inverse_of: :access_group, dependent: :destroy
|
|
5
|
+
has_many :users, through: :access_group_users
|
|
6
|
+
|
|
7
|
+
validates :name, presence: true, uniqueness: true
|
|
8
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateAccessGroupPermissions < ActiveRecord::Migration[7.0]
|
|
2
|
+
def change
|
|
3
|
+
create_table :access_group_permissions do |t|
|
|
4
|
+
t.references :access_group, foreign_key: true
|
|
5
|
+
t.references :permission, foreign_key: true
|
|
6
|
+
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: access_forge-permissions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mark Harbison
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -90,6 +90,15 @@ files:
|
|
|
90
90
|
- lib/access_forge/permissions.rb
|
|
91
91
|
- lib/access_forge/permissions/permission_policy_rule.rb
|
|
92
92
|
- lib/access_forge/permissions/version.rb
|
|
93
|
+
- lib/generators/access_forge/access_groups/access_groups_generator.rb
|
|
94
|
+
- lib/generators/access_forge/access_groups/templates/access_group.rb
|
|
95
|
+
- lib/generators/access_forge/access_groups/templates/access_group_permission.rb
|
|
96
|
+
- lib/generators/access_forge/access_groups/templates/access_group_user.rb
|
|
97
|
+
- lib/generators/access_forge/access_groups/templates/migrations/create_access_group_permissions.rb
|
|
98
|
+
- lib/generators/access_forge/access_groups/templates/migrations/create_access_group_users.rb
|
|
99
|
+
- lib/generators/access_forge/access_groups/templates/migrations/create_access_groups.rb
|
|
100
|
+
- lib/generators/access_forge/access_groups/templates/migrations/create_permissions.rb
|
|
101
|
+
- lib/generators/access_forge/access_groups/templates/permission.rb
|
|
93
102
|
- sig/access_forge-permissions.rbs
|
|
94
103
|
- spec/access_forge/permissions_spec.rb
|
|
95
104
|
- spec/spec_helper.rb
|