c80_shared 0.1.89 → 0.1.90
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/serializers/account_serializer.rb +20 -1
- data/app/serializers/lease/bid_serializer.rb +0 -1
- data/lib/c80_shared/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: 8b74798e7fa2ba84239918bc247e89ceca53912539ae784d14ba6556c0ba13a1
|
4
|
+
data.tar.gz: b6123aae96bf2611736b5005b2459da881e906e8a9476d067229e975cd00fa1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ccb76fbbd4df0cf0297c821711e79dd9e3059cb61fad4b20d379244e4937eef719acd1f1c59908f5a0fff595821def85b0b8f18422bce1c011034c8cd5cee1
|
7
|
+
data.tar.gz: 9fb4506fab81c11b4ccd8b4fa96a19251c5f39767f187c19b177ff9277fb8ccc97cb289b4566dda9e916ffa894640fd2473140e5c6e03cb3e295f30a248794f8
|
@@ -7,6 +7,7 @@ class AccountSerializer < AbstractSerializer
|
|
7
7
|
id
|
8
8
|
type_index
|
9
9
|
props
|
10
|
+
abilities
|
10
11
|
]
|
11
12
|
end
|
12
13
|
|
@@ -38,5 +39,23 @@ class AccountSerializer < AbstractSerializer
|
|
38
39
|
end
|
39
40
|
{ props: props }
|
40
41
|
end
|
42
|
+
|
43
|
+
# список возможностей с учётом запретов
|
44
|
+
def abilities(account)
|
45
|
+
account_class = ::Dictionaries::AccountType::CLASS_BY_TYPE[account.type_id]
|
46
|
+
default_abilities = ::Dicts::Accounts::Ability.all_for_account_class(account_class)
|
47
|
+
prohibited = account.user.permissions
|
48
|
+
|
49
|
+
# отнимаем запрещённые действия из дефолтных
|
50
|
+
not_prohibited = ->(ability) { prohibited.none? { |a| a.action.to_s == ability.index.to_s } }
|
51
|
+
abilities = default_abilities.map do |a|
|
52
|
+
{
|
53
|
+
action: a.index,
|
54
|
+
can: not_prohibited[a]
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
{ abilities: abilities }
|
59
|
+
end
|
41
60
|
end
|
42
|
-
end
|
61
|
+
end
|
data/lib/c80_shared/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_shared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.90
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
|
-
rubygems_version: 3.0.
|
209
|
+
rubygems_version: 3.0.8
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Write a short summary, because RubyGems requires one.
|