adeia 0.14.0 → 0.15.0

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: 80c20ee4c4761c0bb3651f774214cc9863c0ce47
4
- data.tar.gz: a2f50f53ab414860f4654d4a7a46e9c81ba48c8a
3
+ metadata.gz: a93bd33dfa2aa6851e05d96b480b48aaf05a5ba4
4
+ data.tar.gz: 523e4a924d0ee0794ca1da1161d8f6fc45c4509b
5
5
  SHA512:
6
- metadata.gz: f282b9b7555a23ca53aba731b54616d470153ffc29e237ddc9441f3c899a64d77b22cae14965ddd07241bbf7a3cd5dc943f67d5bd8982c6b47531c2dc701f8b4
7
- data.tar.gz: 4bef39c370e8597b9f2f0dd3033cdd5d9c7effdee3d7017562f30b05ba399192de70af4a72b9a0ba0b53864cfae09f4449e1fea55fbb6f62cda138b77c07f140
6
+ metadata.gz: ba8ba952a5954bcfec327216f8f1cf99d1651fc0cd635321b96448b233f2fae569c2f07196928ac704d8f987184b08f9f252d8a42bbd58794e835cda9dcebcbf
7
+ data.tar.gz: c53e4b015e96531ef751ce4a686a00e91039f072d3737b908a4b7d38609d9afc35a865d9c4d3bf748d93c4982acdb15e5268b09cdc054e18931de901f6435e4b
data/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  An discretionary authorization gem for Rails that allows you to have the complete control of your app.
4
4
 
5
+ ## Requirements
6
+
7
+ Requires a User model with:
8
+
9
+ * An method `name`, returning the name of the user.
10
+ * A column `remember_token`, containing a generated token used for the authentification.
11
+
12
+ ```
13
+ rails g model User name:string remember_token:string
14
+ ```
15
+
5
16
  ## Installation
6
17
 
7
18
  Add this line to your application's Gemfile:
@@ -41,13 +52,6 @@ rake adeia:permissions elements="admin/galleries, admin/articles, admin/categori
41
52
  rake adeia:superuser user_id=59
42
53
  ```
43
54
 
44
- ## Requirements
45
-
46
- Requires a User model with:
47
-
48
- * An method `name`, returning the name of the user.
49
- * A column `remember_token`, containing a generated token used for the authentification.
50
-
51
55
  ## Documentation
52
56
 
53
57
  ### Authentification
@@ -113,7 +117,7 @@ def index
113
117
  end
114
118
  ```
115
119
 
116
- By default, the methods (except `require_login!`) use the following parameters:
120
+ By default, each method (except `require_login!`) uses the following parameters:
117
121
 
118
122
  * controller: the controller's name
119
123
  * action: the action's name
@@ -61,6 +61,7 @@ module Adeia
61
61
  ControllerResource.new(self, action: action, controller: controller, resource: resource).authorized?(:rights?)
62
62
  end
63
63
 
64
+
64
65
  # Redirect the user to the stored url or the default one provided
65
66
  #
66
67
  # * *Args* :
@@ -29,6 +29,10 @@ module Adeia
29
29
  @groups ||= Adeia::Group.joins(:group_users).where(adeia_group_users: { user_id: self.id })
30
30
  end
31
31
 
32
+ def belongs_to?(name)
33
+ Adeia::GroupUser.joins(:group).where(user_id: self.id, adeia_groups: { name: name }).exists?
34
+ end
35
+
32
36
  end
33
37
  end
34
38
  end
data/lib/adeia/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Adeia
2
- VERSION = "0.14.0"
2
+ VERSION = "0.15.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adeia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-05 00:00:00.000000000 Z
11
+ date: 2017-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails