uffizzi_core 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb +2 -2
- data/app/controllers/uffizzi_core/application_controller.rb +1 -1
- data/app/lib/uffizzi_core/rbac/user_access_service.rb +12 -14
- data/app/models/uffizzi_core/account.rb +1 -1
- data/app/models/uffizzi_core/activity_item.rb +1 -1
- data/app/models/uffizzi_core/build.rb +1 -1
- data/app/models/uffizzi_core/comment.rb +1 -1
- data/app/models/uffizzi_core/compose_file.rb +1 -1
- data/app/models/uffizzi_core/config_file.rb +1 -1
- data/app/models/uffizzi_core/container.rb +1 -1
- data/app/models/uffizzi_core/container_config_file.rb +1 -1
- data/app/models/uffizzi_core/coupon.rb +1 -1
- data/app/models/uffizzi_core/credential.rb +1 -1
- data/app/models/uffizzi_core/deployment.rb +1 -1
- data/app/models/uffizzi_core/event.rb +1 -1
- data/app/models/uffizzi_core/invitation.rb +1 -1
- data/app/models/uffizzi_core/membership.rb +1 -1
- data/app/models/uffizzi_core/payment.rb +1 -1
- data/app/models/uffizzi_core/price.rb +1 -1
- data/app/models/uffizzi_core/product.rb +1 -1
- data/app/models/uffizzi_core/project.rb +1 -1
- data/app/models/uffizzi_core/rating.rb +1 -1
- data/app/models/uffizzi_core/repo.rb +1 -1
- data/app/models/uffizzi_core/role.rb +2 -2
- data/app/models/uffizzi_core/secret.rb +1 -1
- data/app/models/uffizzi_core/template.rb +1 -1
- data/app/models/uffizzi_core/user.rb +1 -1
- data/app/models/uffizzi_core/user_project.rb +1 -1
- data/lib/uffizzi_core/engine.rb +35 -0
- data/lib/uffizzi_core/version.rb +1 -1
- data/lib/uffizzi_core.rb +1 -31
- metadata +20 -7
- data/app/services/uffizzi_core/user_access_service.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 503ded723d48c023e0c47bc007b75e704927ba6bb13e9ea672feb573b45a2b95
|
4
|
+
data.tar.gz: ac2d0d440e82ea78fc3a5cca1f2dcac89a9db129a4cd2eee4ca712fad2be53d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46299f40846b2ef159fdd856f58cb47584907b26f1a16341007d5c6137f15a4afd905233f8db1e9d33252e652c218a4dba6ac216f59bb09ed00f6627c2b4643b
|
7
|
+
data.tar.gz: 2b1816b02b108dbd24ace6e4a6761fca714a62cd2226048ab2266b59bc09a9861a5f2cc425345326207feec9eeaa6f0ae1e3a539bbca8d2006ac8686fdb90edd
|
@@ -4,7 +4,7 @@ module UffizziCore::DependencyInjectionConcern
|
|
4
4
|
def user_access_module
|
5
5
|
return unless module_exists?(:rbac)
|
6
6
|
|
7
|
-
|
7
|
+
module_class(:rbac).new
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -14,6 +14,6 @@ module UffizziCore::DependencyInjectionConcern
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def module_class(module_name)
|
17
|
-
|
17
|
+
Rails.application.config.uffizzi_core[:dependencies][module_name]&.constantize
|
18
18
|
end
|
19
19
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::ApplicationController < ActionController::Base
|
4
|
-
include Pundit
|
4
|
+
include Pundit::Authorization
|
5
5
|
include UffizziCore::ResponseService
|
6
6
|
include UffizziCore::AuthManagement
|
7
7
|
include UffizziCore::AuthorizationConcern
|
@@ -1,21 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
3
|
+
class UffizziCore::Rbac::UserAccessService
|
4
|
+
def admin_access_to_account?(_user, _account)
|
5
|
+
true
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def any_access_to_account?(_user, _account)
|
9
|
+
true
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def admin_or_developer_access_to_project?(_user, _project)
|
13
|
+
true
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
16
|
+
def any_access_to_project?(_user, _project)
|
17
|
+
true
|
20
18
|
end
|
21
19
|
end
|
@@ -5,7 +5,7 @@ class UffizziCore::Account < UffizziCore::ApplicationRecord
|
|
5
5
|
include UffizziCore::StateMachineConcern
|
6
6
|
extend Enumerize
|
7
7
|
|
8
|
-
self.table_name =
|
8
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:accounts]
|
9
9
|
|
10
10
|
enumerize :kind, in: [:personal, :organizational], scope: true, predicates: true
|
11
11
|
validates :kind, presence: true
|
@@ -21,7 +21,7 @@
|
|
21
21
|
class UffizziCore::ActivityItem < UffizziCore::ApplicationRecord
|
22
22
|
include UffizziCore::ActivityItemRepo
|
23
23
|
|
24
|
-
self.table_name =
|
24
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:activity_items]
|
25
25
|
|
26
26
|
belongs_to :deployment
|
27
27
|
belongs_to :container
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class UffizziCore::Comment < UffizziCore::ApplicationRecord
|
4
4
|
include UffizziCore::CommentRepo
|
5
5
|
|
6
|
-
self.table_name =
|
6
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:comments]
|
7
7
|
|
8
8
|
has_ancestry(cache_depth: true)
|
9
9
|
MAX_DEPTH_LEVEL = 1
|
@@ -14,7 +14,7 @@ class UffizziCore::ComposeFile < UffizziCore::ApplicationRecord
|
|
14
14
|
include AASM
|
15
15
|
extend Enumerize
|
16
16
|
|
17
|
-
self.table_name =
|
17
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:compose_files]
|
18
18
|
|
19
19
|
belongs_to :project
|
20
20
|
belongs_to :added_by, class_name: UffizziCore::User.name, foreign_key: :added_by_id, optional: true
|
@@ -11,7 +11,7 @@ class UffizziCore::ConfigFile < UffizziCore::ApplicationRecord
|
|
11
11
|
include UffizziCore::ConfigFileRepo
|
12
12
|
extend Enumerize
|
13
13
|
|
14
|
-
self.table_name =
|
14
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:config_files]
|
15
15
|
|
16
16
|
belongs_to :project
|
17
17
|
belongs_to :added_by, class_name: UffizziCore::User.name, foreign_key: :added_by_id, optional: true
|
@@ -17,7 +17,7 @@ class UffizziCore::Container < UffizziCore::ApplicationRecord
|
|
17
17
|
include UffizziCore::StateMachineConcern
|
18
18
|
extend Enumerize
|
19
19
|
|
20
|
-
self.table_name =
|
20
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:containers]
|
21
21
|
|
22
22
|
enumerize :kind, in: [:internal, :user], predicates: true
|
23
23
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::ContainerConfigFile < UffizziCore::ApplicationRecord
|
4
|
-
self.table_name =
|
4
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:container_config_files]
|
5
5
|
|
6
6
|
belongs_to :container
|
7
7
|
belongs_to :config_file
|
@@ -4,7 +4,7 @@ class UffizziCore::Credential < UffizziCore::ApplicationRecord
|
|
4
4
|
include AASM
|
5
5
|
include UffizziCore::CredentialRepo
|
6
6
|
|
7
|
-
self.table_name =
|
7
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:credentials]
|
8
8
|
|
9
9
|
belongs_to :account
|
10
10
|
|
@@ -25,7 +25,7 @@ class UffizziCore::Deployment < UffizziCore::ApplicationRecord
|
|
25
25
|
include UffizziCore::DeploymentRepo
|
26
26
|
extend Enumerize
|
27
27
|
|
28
|
-
self.table_name =
|
28
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:deployments]
|
29
29
|
|
30
30
|
enumerize :kind, in: [:standard, :performance, :enterprise, :free], predicates: true, default: :standard
|
31
31
|
|
@@ -4,7 +4,7 @@ class UffizziCore::Event < UffizziCore::ApplicationRecord
|
|
4
4
|
include UffizziCore::EventRepo
|
5
5
|
extend Enumerize
|
6
6
|
|
7
|
-
self.table_name =
|
7
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:events]
|
8
8
|
|
9
9
|
enumerize :state, in: [:queued, :successful, :deployed, :failed, :building, :timeout, :cancelled, :deploying], predicates: true,
|
10
10
|
scope: true
|
@@ -5,7 +5,7 @@ class UffizziCore::Invitation < UffizziCore::ApplicationRecord
|
|
5
5
|
include UffizziCore::StateMachineConcern
|
6
6
|
extend Enumerize
|
7
7
|
|
8
|
-
self.table_name =
|
8
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:invitations]
|
9
9
|
|
10
10
|
enumerize :role, in: [:admin, :developer, :viewer], predicates: true
|
11
11
|
|
@@ -4,7 +4,7 @@ class UffizziCore::Membership < UffizziCore::ApplicationRecord
|
|
4
4
|
include UffizziCore::MembershipRepo
|
5
5
|
extend Enumerize
|
6
6
|
|
7
|
-
self.table_name =
|
7
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:memberships]
|
8
8
|
|
9
9
|
enumerize :role, in: [:admin, :developer, :viewer], predicates: true
|
10
10
|
validates :role, presence: true
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class UffizziCore::Product < UffizziCore::ApplicationRecord
|
4
4
|
include UffizziCore::ProductRepo
|
5
5
|
|
6
|
-
self.table_name =
|
6
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:products]
|
7
7
|
|
8
8
|
has_one :price, dependent: :destroy
|
9
9
|
|
@@ -8,7 +8,7 @@ class UffizziCore::Project < UffizziCore::ApplicationRecord
|
|
8
8
|
include UffizziCore::StateMachineConcern
|
9
9
|
include UffizziCore::ProjectRepo
|
10
10
|
|
11
|
-
self.table_name =
|
11
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:projects]
|
12
12
|
|
13
13
|
belongs_to :account
|
14
14
|
|
@@ -4,7 +4,7 @@ class UffizziCore::Repo < UffizziCore::ApplicationRecord
|
|
4
4
|
extend Enumerize
|
5
5
|
include UffizziCore::RepoRepo
|
6
6
|
|
7
|
-
self.table_name =
|
7
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:repos]
|
8
8
|
|
9
9
|
enumerize :kind, in: [:buildpacks18, :dockerfile, :dotnet, :gatsby, :barestatic], predicates: true
|
10
10
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::Role < UffizziCore::ApplicationRecord
|
4
|
-
self.table_name =
|
4
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:roles]
|
5
5
|
|
6
|
-
has_and_belongs_to_many :users, join_table:
|
6
|
+
has_and_belongs_to_many :users, join_table: Rails.application.config.uffizzi_core[:table_names][:users_roles]
|
7
7
|
|
8
8
|
belongs_to :resource,
|
9
9
|
polymorphic: true,
|
@@ -4,7 +4,7 @@ class UffizziCore::Template < UffizziCore::ApplicationRecord
|
|
4
4
|
include UffizziCore::TemplateRepo
|
5
5
|
extend Enumerize
|
6
6
|
|
7
|
-
self.table_name =
|
7
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:templates]
|
8
8
|
|
9
9
|
belongs_to :added_by, class_name: UffizziCore::User.name, foreign_key: :added_by_id
|
10
10
|
belongs_to :project, touch: true
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class UffizziCore::UserProject < UffizziCore::ApplicationRecord
|
4
4
|
extend Enumerize
|
5
5
|
|
6
|
-
self.table_name =
|
6
|
+
self.table_name = Rails.application.config.uffizzi_core[:table_names][:user_projects]
|
7
7
|
|
8
8
|
enumerize :role, in: [:admin, :developer, :viewer], predicates: true
|
9
9
|
validates :role, presence: true
|
data/lib/uffizzi_core/engine.rb
CHANGED
@@ -10,6 +10,41 @@ module UffizziCore
|
|
10
10
|
config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
|
11
11
|
end
|
12
12
|
|
13
|
+
config.uffizzi_core = ActiveSupport::OrderedOptions.new
|
14
|
+
|
15
|
+
config.uffizzi_core.dependencies = {
|
16
|
+
rbac: 'UffizziCore::Rbac::UserAccessService',
|
17
|
+
}
|
18
|
+
|
19
|
+
config.uffizzi_core.table_names = {
|
20
|
+
accounts: :uffizzi_core_accounts,
|
21
|
+
activity_items: :uffizzi_core_activity_items,
|
22
|
+
builds: :uffizzi_core_builds,
|
23
|
+
comments: :uffizzi_core_comments,
|
24
|
+
compose_files: :uffizzi_core_compose_files,
|
25
|
+
config_files: :uffizzi_core_config_files,
|
26
|
+
container_config_files: :uffizzi_core_container_config_files,
|
27
|
+
containers: :uffizzi_core_containers,
|
28
|
+
coupons: :uffizzi_core_coupons,
|
29
|
+
credentials: :uffizzi_core_credentials,
|
30
|
+
deployments: :uffizzi_core_deployments,
|
31
|
+
events: :uffizzi_core_events,
|
32
|
+
invitations: :uffizzi_core_invitations,
|
33
|
+
memberships: :uffizzi_core_memberships,
|
34
|
+
payments: :uffizzi_core_payments,
|
35
|
+
prices: :uffizzi_core_prices,
|
36
|
+
products: :uffizzi_core_products,
|
37
|
+
projects: :uffizzi_core_projects,
|
38
|
+
ratings: :uffizzi_core_ratings,
|
39
|
+
repos: :uffizzi_core_repos,
|
40
|
+
roles: :uffizzi_core_roles,
|
41
|
+
secrets: :uffizzi_core_secrets,
|
42
|
+
templates: :uffizzi_core_templates,
|
43
|
+
user_projects: :uffizzi_core_user_projects,
|
44
|
+
users: :uffizzi_core_users,
|
45
|
+
users_roles: :uffizzi_core_users_roles,
|
46
|
+
}
|
47
|
+
|
13
48
|
ActiveModelSerializers.config.adapter = :json
|
14
49
|
end
|
15
50
|
end
|
data/lib/uffizzi_core/version.rb
CHANGED
data/lib/uffizzi_core.rb
CHANGED
@@ -27,35 +27,5 @@ require 'sidekiq'
|
|
27
27
|
require 'virtus'
|
28
28
|
|
29
29
|
module UffizziCore
|
30
|
-
mattr_accessor :
|
31
|
-
rbac: 'UffizziCore::Rbac::UserAccessService',
|
32
|
-
}
|
33
|
-
mattr_accessor :table_names, default: {
|
34
|
-
accounts: :uffizzi_core_accounts,
|
35
|
-
activity_items: :uffizzi_core_activity_items,
|
36
|
-
builds: :uffizzi_core_builds,
|
37
|
-
comments: :uffizzi_core_comments,
|
38
|
-
compose_files: :uffizzi_core_compose_files,
|
39
|
-
config_files: :uffizzi_core_config_files,
|
40
|
-
container_config_files: :uffizzi_core_container_config_files,
|
41
|
-
containers: :uffizzi_core_containers,
|
42
|
-
coupons: :uffizzi_core_coupons,
|
43
|
-
credentials: :uffizzi_core_credentials,
|
44
|
-
deployments: :uffizzi_core_deployments,
|
45
|
-
events: :uffizzi_core_events,
|
46
|
-
invitations: :uffizzi_core_invitations,
|
47
|
-
memberships: :uffizzi_core_memberships,
|
48
|
-
payments: :uffizzi_core_payments,
|
49
|
-
prices: :uffizzi_core_prices,
|
50
|
-
products: :uffizzi_core_products,
|
51
|
-
projects: :uffizzi_core_projects,
|
52
|
-
ratings: :uffizzi_core_ratings,
|
53
|
-
repos: :uffizzi_core_repos,
|
54
|
-
roles: :uffizzi_core_roles,
|
55
|
-
secrets: :uffizzi_core_secrets,
|
56
|
-
templates: :uffizzi_core_templates,
|
57
|
-
user_projects: :uffizzi_core_user_projects,
|
58
|
-
users: :uffizzi_core_users,
|
59
|
-
users_roles: :uffizzi_core_users_roles,
|
60
|
-
}
|
30
|
+
mattr_accessor :table_names, default: {}
|
61
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-05-
|
12
|
+
date: 2022-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -451,6 +451,20 @@ dependencies:
|
|
451
451
|
- - "~>"
|
452
452
|
- !ruby/object:Gem::Version
|
453
453
|
version: 3.1.7
|
454
|
+
- !ruby/object:Gem::Dependency
|
455
|
+
name: bump
|
456
|
+
requirement: !ruby/object:Gem::Requirement
|
457
|
+
requirements:
|
458
|
+
- - ">="
|
459
|
+
- !ruby/object:Gem::Version
|
460
|
+
version: '0'
|
461
|
+
type: :development
|
462
|
+
prerelease: false
|
463
|
+
version_requirements: !ruby/object:Gem::Requirement
|
464
|
+
requirements:
|
465
|
+
- - ">="
|
466
|
+
- !ruby/object:Gem::Version
|
467
|
+
version: '0'
|
454
468
|
- !ruby/object:Gem::Dependency
|
455
469
|
name: bundler
|
456
470
|
requirement: !ruby/object:Gem::Requirement
|
@@ -661,7 +675,7 @@ dependencies:
|
|
661
675
|
- - ">="
|
662
676
|
- !ruby/object:Gem::Version
|
663
677
|
version: '0'
|
664
|
-
description:
|
678
|
+
description: uffizzi-core
|
665
679
|
email:
|
666
680
|
- info@uffizzi.com
|
667
681
|
executables: []
|
@@ -887,7 +901,6 @@ files:
|
|
887
901
|
- app/services/uffizzi_core/response_service.rb
|
888
902
|
- app/services/uffizzi_core/template_service.rb
|
889
903
|
- app/services/uffizzi_core/token_service.rb
|
890
|
-
- app/services/uffizzi_core/user_access_service.rb
|
891
904
|
- app/services/uffizzi_core/user_generator_service.rb
|
892
905
|
- app/utils/uffizzi_core/converters.rb
|
893
906
|
- app/validators/uffizzi_core/email_validator.rb
|
@@ -917,8 +930,8 @@ licenses:
|
|
917
930
|
- Apache-2.0
|
918
931
|
metadata:
|
919
932
|
homepage_uri: https://uffizzi.com
|
920
|
-
source_code_uri: https://github.com/UffizziCloud/
|
921
|
-
changelog_uri: https://github.com/UffizziCloud/
|
933
|
+
source_code_uri: https://github.com/UffizziCloud/uffizzi_core
|
934
|
+
changelog_uri: https://github.com/UffizziCloud/uffizzi_core/blob/master/CHANGELOG.md
|
922
935
|
post_install_message:
|
923
936
|
rdoc_options: []
|
924
937
|
require_paths:
|
@@ -937,5 +950,5 @@ requirements: []
|
|
937
950
|
rubygems_version: 3.2.22
|
938
951
|
signing_key:
|
939
952
|
specification_version: 4
|
940
|
-
summary:
|
953
|
+
summary: uffizzi-core
|
941
954
|
test_files: []
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::UserAccessService
|
4
|
-
attr_accessor :user_access_module
|
5
|
-
|
6
|
-
delegate :admin_access_to_account?, :developer_access_to_account?, :viewer_access_to_account?,
|
7
|
-
:admin_or_developer_access_to_account?, :any_access_to_account?, :admin_access_to_project?,
|
8
|
-
:developer_access_to_project?, :viewer_access_to_project?, :admin_or_developer_access_to_project?,
|
9
|
-
:any_access_to_project?, :global_admin?, to: :@user_access_module
|
10
|
-
|
11
|
-
def initialize(user_access_module)
|
12
|
-
@user_access_module = user_access_module
|
13
|
-
end
|
14
|
-
end
|