klastera 1.4.4 → 1.4.4.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/models/klastera/concerns/clusterizable.rb +4 -4
- data/app/models/klastera/concerns/user.rb +12 -12
- data/lib/klastera/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef0519c775285f8e1684e2b7710f6a2729d89335f4742a04f4267a156870746d
|
4
|
+
data.tar.gz: 87adbf443e12d8dc8eb93a6d40dd7518d138dea65c404fc8ac19e9a69ea7a742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 252b2cc54c25a5d1338d7064610ff2806c4e246f44f1101809fe97b5d0167e9d75de71994f1820e67f0e9c26e164be36ea2fd6ee0922eea9c8152c4ebbce83bb
|
7
|
+
data.tar.gz: 573ef0536c76d2fb6b199ac188cc90ec8f04b780f4d2562a6772b3f73051e77f62d4897ecc633fd3b869ae5d4c5f97a536bb31ebcf13a1c8c58904a37d326d4c
|
@@ -9,8 +9,8 @@ module Klastera::Concerns::Clusterizable
|
|
9
9
|
has_many :cluster_entities, as: :entity, class_name: Klastera::ClusterEntity
|
10
10
|
accepts_nested_attributes_for :cluster_entities, reject_if: :all_blank, allow_destroy: true
|
11
11
|
|
12
|
-
validates :cluster_id, presence: true, if:
|
13
|
-
validate :at_least_one_cluster_entity, if:
|
12
|
+
validates :cluster_id, presence: true, if: -> { cluster_id.present? && organization.present? && organization.required_suborganization_mode? }
|
13
|
+
validate :at_least_one_cluster_entity, if: -> { organization.present? && organization.required_suborganization_mode? }
|
14
14
|
validate :uniqueness_of_cluster_entity_record
|
15
15
|
|
16
16
|
scope :includes_cluster, -> { includes(cluster_entities: :cluster) }
|
@@ -22,7 +22,7 @@ module Klastera::Concerns::Clusterizable
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def allow_multiple_clusters?(default=:one)
|
25
|
-
organization.cluster_cardinality_of(self.class, default: default) == :many
|
25
|
+
organization.present? && organization.cluster_cardinality_of(self.class, default: default) == :many
|
26
26
|
end
|
27
27
|
|
28
28
|
##
|
@@ -32,7 +32,7 @@ module Klastera::Concerns::Clusterizable
|
|
32
32
|
##
|
33
33
|
def clusters_string_separated_by(separator,attribute=:name)
|
34
34
|
Klastera.entity_clusters_string_list!(
|
35
|
-
|
35
|
+
cluster_entities, separator, attribute
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
@@ -11,29 +11,29 @@ module Klastera::Concerns::User
|
|
11
11
|
|
12
12
|
has_many :cluster_users, inverse_of: :user, class_name: ::ClusterUser.to_s
|
13
13
|
accepts_nested_attributes_for :cluster_users, reject_if: :all_blank, allow_destroy: true
|
14
|
-
validates :cluster_role, presence: true, if:
|
15
|
-
validates :cluster_role, inclusion: { in: CLUSTER_ROLES , message: I18n.t('klastera.clusters.wrong_option') }, if:
|
16
|
-
validate :at_least_one_role, if:
|
14
|
+
validates :cluster_role, presence: true, if: -> { organization.present? && organization.is_in_cluster_mode? }
|
15
|
+
validates :cluster_role, inclusion: { in: CLUSTER_ROLES , message: I18n.t('klastera.clusters.wrong_option') }, if: -> { cluster_role.present? }
|
16
|
+
validate :at_least_one_role, if: -> { use_cluster? && try(:need_cluster_assignation?) }
|
17
17
|
|
18
|
-
def use_cluster?;
|
18
|
+
def use_cluster?; cluster_role.present?; end
|
19
19
|
|
20
|
-
def is_a_cluster_root?;
|
21
|
-
def is_a_cluster_admin?;
|
22
|
-
def is_a_cluster_user?;
|
20
|
+
def is_a_cluster_root?; cluster_role == CLUSTER_ROOT; end
|
21
|
+
def is_a_cluster_admin?; cluster_role == CLUSTER_ADMIN; end
|
22
|
+
def is_a_cluster_user?; cluster_role == CLUSTER_USER; end
|
23
23
|
|
24
24
|
def need_cluster_assignation?
|
25
|
-
|
25
|
+
organization.present? && organization.required_suborganization_mode? && is_a_cluster_user?
|
26
26
|
end
|
27
27
|
|
28
28
|
def can_admin_clusters?
|
29
|
-
|
29
|
+
organization.present? && organization.is_in_cluster_mode? && ( is_a_cluster_admin? || is_a_cluster_root? )
|
30
30
|
end
|
31
31
|
|
32
32
|
#
|
33
33
|
# It tells if this user should see what they cluster role or organization dictates
|
34
34
|
# Adminers and users from show cluster modes skip cluster clause
|
35
35
|
def cannot_skip_cluster_clause?
|
36
|
-
! (
|
36
|
+
! ( is_a_cluster_admin? || is_a_cluster_root? || ( organization.present? && organization.optional_suborganization_mode? && cluster_users.blank? ) )
|
37
37
|
end
|
38
38
|
|
39
39
|
#
|
@@ -43,9 +43,9 @@ module Klastera::Concerns::User
|
|
43
43
|
# cluster_id is present (on show/use mode organizations).
|
44
44
|
#
|
45
45
|
def try_to_clusterify!(role,cluster_ids)
|
46
|
-
if
|
46
|
+
if organization.present? && organization.is_in_cluster_mode?
|
47
47
|
self.cluster_role = role
|
48
|
-
if
|
48
|
+
if ( organization.present? && organization.required_suborganization_mode? ) || cluster_ids.present?
|
49
49
|
timestamp = DateTime.now.to_i
|
50
50
|
nested_attributes = {}
|
51
51
|
cluster_ids.each do |cluster_id|
|
data/lib/klastera/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klastera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.4
|
4
|
+
version: 1.4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gino Barahona
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.1.2
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Clusterization Engine
|