tramway-admin 1.24 → 1.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 011d456ac295086199431405fbb6d3531094e79c985918fa968a789ca1f02bed
4
- data.tar.gz: 0a9d46e59b30f6b4fee4d83adcf1d69bffe184ec965931cbb3e318a5111b0fc0
3
+ metadata.gz: 34967906a603a71e0cae0bcae9e33a90d49e8da4604ea579ff4c4d1444a65ccc
4
+ data.tar.gz: f23607c1c2d41f5f7c01b8371a12b926ac884d58eca1ffee8880c7b1c05f2162
5
5
  SHA512:
6
- metadata.gz: 0c11ce53229c6bb4e73d482a575d65e268d02b93cfff84545cb5385c7e4289c54e0607b01e5c77c2fe683235babd5fe134d6487c5213594d8c31765c299c7823
7
- data.tar.gz: 6cf766da4f7d49f79908a097a155435e6646651599fa4d5c0df8e450a4ff33425cdc57a7e4a4cee4a519c2a8f0a588ea4364c522c635e4c2055be1f30879497a
6
+ metadata.gz: bab788569b6fce0e9c7040e30e2f3ca887f4b6d654530d950ce4e7a2be39f6db75a2bab80e56b7a4d91dbcc252099bc0e65a66d9d42e463a8409d843538a274f
7
+ data.tar.gz: d82bcc80305523b3996dae13cdccd4053b7a72f79428e8eb2c718a13446522ae825a53d8ab9cdc029def1324f99a5c9b83b7b74df92444c38288029ea63d68ec
data/README.md CHANGED
@@ -79,6 +79,25 @@ By default users with role `admin` have access to all models used as arguments i
79
79
  ::Tramway::Event::Participant, project: #{project_name_which_you_used_in_application_name}, role: :another_role
80
80
  ```
81
81
 
82
+ You can set functions which are available by default some CRUD functions for any role:
83
+
84
+ ```ruby
85
+ # this line gives access only index page to YourModel for partner role
86
+ ::Tramway::Admin.set_available_models YourModel => [ :index ], role: :partner
87
+ ```
88
+
89
+ You can set conditions for functions which are available for any role:
90
+
91
+ ```ruby
92
+ # this line gives access to destroy only record with name `Elon Musk`
93
+
94
+ ::Tramway::Admin.set_available_models YourModel => [
95
+ destroy => lambda do |record|
96
+ record.name == 'Elon Musk'
97
+ end
98
+ ], role: :partner
99
+ ```
100
+
82
101
  Here docs about changing roles of `Tramway::User::User` model [Readme](https://github.com/ulmic/tramway-dev/tree/develop/tramway#if-you-want-to-edit-roles-to-the-tramwayuseruser-class)
83
102
 
84
103
  Run server `rails s`
@@ -47,7 +47,7 @@ module Tramway
47
47
  elsif a.is_a? Hash
48
48
  a.keys.first.to_sym == action.to_sym
49
49
  end
50
- end.first
50
+ end&.first
51
51
 
52
52
  return false unless availability.present?
53
53
  return true if availability.is_a? Symbol
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '1.24'
5
+ VERSION = '1.24.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.24'
4
+ version: 1.24.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-kaminari-views