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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 302b70eb9a075299310a7cdf997ff1a25400c48e9650edb240bb4c915fc1add0
4
- data.tar.gz: 35e696ea03564f3bab6a1d5b366937206c7937e2165a3245caff52c34fb79078
3
+ metadata.gz: 8b74798e7fa2ba84239918bc247e89ceca53912539ae784d14ba6556c0ba13a1
4
+ data.tar.gz: b6123aae96bf2611736b5005b2459da881e906e8a9476d067229e975cd00fa1c
5
5
  SHA512:
6
- metadata.gz: 945626034ec455457efaa3e8bc7c460526d39d6c241dd3cced31f9f42076c9b93ead3826eb26f1b6498a27de63e94890c07a63fa023f8e7c475fe71995382563
7
- data.tar.gz: 0a793903aa2eac4c0d00f52aad2b07dfa50b40ccd7101e6ac3c51bd02598110497aeec962678eb0612c030911d79757abad11099f3ef3aaadedf9cce9f2e268f
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
@@ -50,7 +50,6 @@ module Lease
50
50
  def boat(bid)
51
51
  boat = bid.boat
52
52
  boat_serialized = BoatSerializer.serialize boat, attributes: %i[
53
- id
54
53
  name
55
54
  boat_length
56
55
  guests_total
@@ -1,3 +1,3 @@
1
1
  module C80Shared
2
- VERSION = "0.1.89"
2
+ VERSION = "0.1.90"
3
3
  end
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.89
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-05-25 00:00:00.000000000 Z
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.6
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.