uffizzi_core 0.1.5 → 0.1.6
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/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 +14 -12
- 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/app/services/uffizzi_core/user_access_service.rb +14 -0
- data/lib/uffizzi_core/engine.rb +0 -35
- data/lib/uffizzi_core/version.rb +1 -1
- data/lib/uffizzi_core.rb +31 -1
- metadata +11 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d11e0fbdafef5829631ae769dab8ecfba065e8faf8fd16c008e6509371ae37
|
4
|
+
data.tar.gz: 5822903bdc95b70aef3ea7fe402332ed6f3815c9661c042597f7adde8a69fe45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7617ee397e75a89ea1ddf79a445151fa3b0652008590d3893216833ba55cc1da4ffc23bb3cee448507f9a591c1ff9572fb03713ab1c3bdce652cfdc3b5de28b8
|
7
|
+
data.tar.gz: 465daea8766e80386c3229b20ab0a44152c860013877d14bdbcdc60b020745a834b5f67c41c3792d6fd31a5f7e84a92960ccbe0b6c905586867f65d2eabacdc5
|
@@ -4,7 +4,7 @@ module UffizziCore::DependencyInjectionConcern
|
|
4
4
|
def user_access_module
|
5
5
|
return unless module_exists?(:rbac)
|
6
6
|
|
7
|
-
module_class(:rbac)
|
7
|
+
UffizziCore::UserAccessService.new(module_class(:rbac))
|
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
|
+
UffizziCore.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
|
5
5
|
include UffizziCore::ResponseService
|
6
6
|
include UffizziCore::AuthManagement
|
7
7
|
include UffizziCore::AuthorizationConcern
|
@@ -1,19 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module UffizziCore::Rbac::UserAccessService
|
4
|
+
class << self
|
5
|
+
def admin_access_to_account?(_user, _account)
|
6
|
+
true
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def any_access_to_account?(_user, _account)
|
10
|
+
true
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def admin_or_developer_access_to_project?(_user, _project)
|
14
|
+
true
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
def any_access_to_project?(_user, _project)
|
18
|
+
true
|
19
|
+
end
|
18
20
|
end
|
19
21
|
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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.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 = UffizziCore.table_names[:roles]
|
5
5
|
|
6
|
-
has_and_belongs_to_many :users, join_table:
|
6
|
+
has_and_belongs_to_many :users, join_table: UffizziCore.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 = UffizziCore.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 = UffizziCore.table_names[:user_projects]
|
7
7
|
|
8
8
|
enumerize :role, in: [:admin, :developer, :viewer], predicates: true
|
9
9
|
validates :role, presence: true
|
@@ -0,0 +1,14 @@
|
|
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
|
data/lib/uffizzi_core/engine.rb
CHANGED
@@ -10,41 +10,6 @@ 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
|
-
|
48
13
|
ActiveModelSerializers.config.adapter = :json
|
49
14
|
end
|
50
15
|
end
|
data/lib/uffizzi_core/version.rb
CHANGED
data/lib/uffizzi_core.rb
CHANGED
@@ -27,5 +27,35 @@ require 'sidekiq'
|
|
27
27
|
require 'virtus'
|
28
28
|
|
29
29
|
module UffizziCore
|
30
|
-
mattr_accessor :
|
30
|
+
mattr_accessor :dependencies, default: {
|
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
|
+
}
|
31
61
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
8
8
|
- Grayson Adkins
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-05-
|
12
|
+
date: 2022-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -451,20 +451,6 @@ 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'
|
468
454
|
- !ruby/object:Gem::Dependency
|
469
455
|
name: bundler
|
470
456
|
requirement: !ruby/object:Gem::Requirement
|
@@ -675,7 +661,7 @@ dependencies:
|
|
675
661
|
- - ">="
|
676
662
|
- !ruby/object:Gem::Version
|
677
663
|
version: '0'
|
678
|
-
description:
|
664
|
+
description: uffizzi_core
|
679
665
|
email:
|
680
666
|
- info@uffizzi.com
|
681
667
|
executables: []
|
@@ -901,6 +887,7 @@ files:
|
|
901
887
|
- app/services/uffizzi_core/response_service.rb
|
902
888
|
- app/services/uffizzi_core/template_service.rb
|
903
889
|
- app/services/uffizzi_core/token_service.rb
|
890
|
+
- app/services/uffizzi_core/user_access_service.rb
|
904
891
|
- app/services/uffizzi_core/user_generator_service.rb
|
905
892
|
- app/utils/uffizzi_core/converters.rb
|
906
893
|
- app/validators/uffizzi_core/email_validator.rb
|
@@ -930,9 +917,9 @@ licenses:
|
|
930
917
|
- Apache-2.0
|
931
918
|
metadata:
|
932
919
|
homepage_uri: https://uffizzi.com
|
933
|
-
source_code_uri: https://github.com/UffizziCloud/
|
934
|
-
changelog_uri: https://github.com/UffizziCloud/
|
935
|
-
post_install_message:
|
920
|
+
source_code_uri: https://github.com/UffizziCloud/uffizzi_app/tree/main/core
|
921
|
+
changelog_uri: https://github.com/UffizziCloud/uffizzi_app/blob/main/core/CHANGELOG.md
|
922
|
+
post_install_message:
|
936
923
|
rdoc_options: []
|
937
924
|
require_paths:
|
938
925
|
- lib
|
@@ -947,9 +934,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
947
934
|
- !ruby/object:Gem::Version
|
948
935
|
version: '0'
|
949
936
|
requirements: []
|
950
|
-
|
951
|
-
|
952
|
-
signing_key:
|
937
|
+
rubygems_version: 3.2.22
|
938
|
+
signing_key:
|
953
939
|
specification_version: 4
|
954
|
-
summary:
|
940
|
+
summary: uffizzi_core
|
955
941
|
test_files: []
|