uffizzi_core 1.1.2 → 2.0.1
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/uffizzi_core/api/cli/v1/accounts/projects_controller.rb +2 -5
- data/app/controllers/uffizzi_core/api/cli/v1/projects_controller.rb +1 -1
- data/app/lib/uffizzi_core/concerns/models/account.rb +1 -0
- data/app/lib/uffizzi_core/concerns/models/credential.rb +3 -0
- data/app/lib/uffizzi_core/concerns/models/user.rb +6 -2
- data/app/repositories/uffizzi_core/account_repo.rb +10 -0
- data/app/services/uffizzi_core/project_service.rb +3 -5
- data/app/services/uffizzi_core/user_generator_service.rb +1 -1
- data/config/locales/en.activerecord.yml +2 -2
- data/db/seeds.rb +1 -1
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8dde4ab08b392e84558c16e4967250af65c53920c983b1736df5af3091bbdac
|
|
4
|
+
data.tar.gz: c7267a556db1b7132881ec0d9424eef05ce8dbbdf3b255456aba42bf0c38836c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27c1495b43f347282da5ac664db5485d4d4f5a751660ae502baa76b23990656546dcfb16f3221b48bf1d6f7f9fa8919d0b8e8a665e041cf05c446d95305ad82a
|
|
7
|
+
data.tar.gz: 2a0b7ae8d5e85aa69bc1c93f8e9a9bf6658b19a33bec346ecf9296a8c7a8e8defa10b93be8ff381c296578a0b90d9be8c31b1b5d13fb7bc20b7f7a92c96ce53f
|
|
@@ -17,11 +17,8 @@ class UffizziCore::Api::Cli::V1::Accounts::ProjectsController < UffizziCore::Api
|
|
|
17
17
|
|
|
18
18
|
def create
|
|
19
19
|
project_form = UffizziCore::Api::Cli::V1::Project::CreateForm.new(project_params)
|
|
20
|
-
project_form.account = current_user.
|
|
21
|
-
|
|
22
|
-
if project_form.save
|
|
23
|
-
UffizziCore::ProjectService.add_users_to_project!(project_form, current_user)
|
|
24
|
-
end
|
|
20
|
+
project_form.account = current_user.accounts.find(params[:account_id])
|
|
21
|
+
UffizziCore::ProjectService.add_users_to_project!(project_form, project_form.account) if project_form.save
|
|
25
22
|
|
|
26
23
|
respond_with project_form
|
|
27
24
|
end
|
|
@@ -53,7 +53,7 @@ class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1:
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def policy_context
|
|
56
|
-
account = resource_project&.account || current_user.
|
|
56
|
+
account = resource_project&.account || current_user.default_account
|
|
57
57
|
|
|
58
58
|
UffizziCore::AccountContext.new(current_user, user_access_module, account, params)
|
|
59
59
|
end
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
module UffizziCore::Concerns::Models::Credential
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
|
6
7
|
included do
|
|
7
8
|
include AASM
|
|
8
9
|
include UffizziCore::CredentialRepo
|
|
10
|
+
extend Enumerize
|
|
9
11
|
|
|
10
12
|
self.table_name = UffizziCore.table_names[:credentials]
|
|
11
13
|
|
|
@@ -70,4 +72,5 @@ module UffizziCore::Concerns::Models::Credential
|
|
|
70
72
|
end
|
|
71
73
|
end
|
|
72
74
|
end
|
|
75
|
+
# rubocop:enable Metrics/BlockLength
|
|
73
76
|
end
|
|
@@ -24,8 +24,12 @@ module UffizziCore::Concerns::Models::User
|
|
|
24
24
|
|
|
25
25
|
enumerize :creation_source, in: UffizziCore.user_creation_sources, predicates: true
|
|
26
26
|
|
|
27
|
-
def
|
|
28
|
-
|
|
27
|
+
def default_account
|
|
28
|
+
personal_account
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def personal_account
|
|
32
|
+
accounts.find_by(kind: UffizziCore::Account.kind.personal)
|
|
29
33
|
end
|
|
30
34
|
|
|
31
35
|
def active_projects
|
|
@@ -36,11 +36,9 @@ class UffizziCore::ProjectService
|
|
|
36
36
|
UffizziCore::ComposeFile::ErrorsService.update_compose_errors!(compose_file, new_errors, compose_file.content)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def add_users_to_project!(project,
|
|
40
|
-
user_projects =
|
|
41
|
-
|
|
42
|
-
current_user.organizational_account.memberships.where(role: UffizziCore::Membership.role.admin).map do |membership|
|
|
43
|
-
user_projects << { project: project, user: membership.user, role: UffizziCore::UserProject.role.admin }
|
|
39
|
+
def add_users_to_project!(project, account)
|
|
40
|
+
user_projects = account.memberships.where(role: UffizziCore::Membership.role.admin).map do |membership|
|
|
41
|
+
{ project: project, user: membership.user, role: UffizziCore::UserProject.role.admin }
|
|
44
42
|
end
|
|
45
43
|
|
|
46
44
|
UffizziCore::UserProject.create!(user_projects)
|
|
@@ -19,8 +19,8 @@ en:
|
|
|
19
19
|
uffizzi_core/deployment:
|
|
20
20
|
attributes:
|
|
21
21
|
containers:
|
|
22
|
-
max_memory_limit_error:
|
|
23
|
-
max_memory_request_error:
|
|
22
|
+
max_memory_limit_error: "Memory limit of containers must be less than %{max}"
|
|
23
|
+
max_memory_request_error: "Memory request of containers must be less than %{max}"
|
|
24
24
|
uffizzi_core/user:
|
|
25
25
|
attributes:
|
|
26
26
|
email:
|
data/db/seeds.rb
CHANGED
|
@@ -9,7 +9,7 @@ user = UffizziCore::User.create!(
|
|
|
9
9
|
account = UffizziCore::Account.create!(
|
|
10
10
|
owner: user, name: 'default',
|
|
11
11
|
state: UffizziCore::Account::STATE_ACTIVE,
|
|
12
|
-
kind: UffizziCore::Account.kind.
|
|
12
|
+
kind: UffizziCore::Account.kind.personal
|
|
13
13
|
)
|
|
14
14
|
user.memberships.create!(account: account, role: UffizziCore::Membership.role.admin)
|
|
15
15
|
project = account.projects.create!(name: 'default', slug: 'default', state: UffizziCore::Project::STATE_ACTIVE)
|
data/lib/uffizzi_core/version.rb
CHANGED
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:
|
|
4
|
+
version: 2.0.1
|
|
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-
|
|
12
|
+
date: 2022-10-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: aasm
|
|
@@ -862,6 +862,7 @@ files:
|
|
|
862
862
|
- app/policies/uffizzi_core/api/cli/v1/projects/secrets_policy.rb
|
|
863
863
|
- app/policies/uffizzi_core/api/cli/v1/projects_policy.rb
|
|
864
864
|
- app/policies/uffizzi_core/application_policy.rb
|
|
865
|
+
- app/repositories/uffizzi_core/account_repo.rb
|
|
865
866
|
- app/repositories/uffizzi_core/activity_item_repo.rb
|
|
866
867
|
- app/repositories/uffizzi_core/basic_order_repo.rb
|
|
867
868
|
- app/repositories/uffizzi_core/build_repo.rb
|