check_permission 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 13be71cda261e5fec78b8a0733c048b72cb7c2bf
4
- data.tar.gz: fa8c7df9e0aa27bef3474231fe514298c736028e
3
+ metadata.gz: 4b9cdc6ec4c9b2140900fd3fc555b87d02a0b29a
4
+ data.tar.gz: 8c3db4cf6a57b8d8f6b03abeca622fb826f474c9
5
5
  SHA512:
6
- metadata.gz: 625f60b22333f334570d1abbf0a2a7e973dafe43f3871d486a8f42e8ec4b605447a9fd0b460b9f0a0a17499b7b2a60a4008d25466c0585c3c8e1b9167e90f1c3
7
- data.tar.gz: 081346a0909b3db218c7e21c38b76675bffb74399c0362fcb05779918d099914c5529255e6d9d2efa154471c903cfe5409122129b94e2f11ddf1cb83638fe180
6
+ metadata.gz: 88f44f9f528329fc2a8a615decf58f5ee672a5787bf95d78c97e05f7d37ebc4b92816e9620e7ac1805e5f67e45c87b1e9dd2693205705e487b857e8d9664de10
7
+ data.tar.gz: 0dc24fc1b0dd11859ccae8de077341b878a67dc161c5623eb77597930b55cb79da80b9d127ee1cdd950a8cf13bdd167b981969a1e7716c6698af6dcefaee1144
data/README.md CHANGED
@@ -74,7 +74,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
74
74
 
75
75
  ## Contributing
76
76
 
77
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/check_permission.
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/snlkumar/permission.
78
78
 
79
79
 
80
80
  ## License
Binary file
@@ -1,3 +1,3 @@
1
1
  module CheckPermission
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,24 +10,24 @@ module CheckPermission
10
10
  rescue
11
11
  return raise "current_user is nil"
12
12
  else
13
- return result permission, resource
13
+ return result permission, resource, action
14
14
  end
15
15
  end
16
16
 
17
17
  private
18
18
 
19
- def result permission, resource
19
+ def result permission, resource, action
20
20
  permission = current_user.permissions.where(resource_name: resource).last
21
21
  return false if permission.nil?
22
22
  case action.to_sym
23
- when :index
24
- return permission.read_only
25
- when :create
26
- return permission.create_only
27
- when :update
28
- return permission.update_only
23
+ when :index, :show
24
+ return permission.is_read
25
+ when :create, :new
26
+ return permission.is_create
27
+ when :update, :edit
28
+ return permission.is_update
29
29
  when :destroy, :delete
30
- return permission.destroy_only
30
+ return permission.is_destroy
31
31
  else
32
32
  return false
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: check_permission
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sunil
@@ -68,6 +68,7 @@ files:
68
68
  - Rakefile
69
69
  - bin/console
70
70
  - bin/setup
71
+ - check_permission-0.1.0.gem
71
72
  - check_permission.gemspec
72
73
  - lib/check_permission.rb
73
74
  - lib/check_permission/version.rb