burlesque 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +34 -7
- data/app/models/burlesque/role.rb +3 -0
- data/lib/burlesque/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -59,6 +59,22 @@ Update | User | Can Update a User (:edit, :update)
|
|
59
59
|
Destroy | User | Can delete a User
|
60
60
|
|
61
61
|
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
Si tus acciones no son RESTful:
|
67
|
+
|
68
|
+
|
69
|
+
Burlesque::Role.find_or_crate_by_name 'user#confirm' # Para poder confirmar usuario
|
70
|
+
Burlesque::Role.find_or_crate_by_name 'user#lock' # Para poder bloquear un usuario
|
71
|
+
|
72
|
+
Burlesque::Role.find_or_crate_by_name 'all#manage' # Para un rol de Super Administrador
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
62
78
|
## Defining Group's
|
63
79
|
|
64
80
|
Group names must be unique. The best way to define Burlesque groups is:
|
@@ -131,8 +147,8 @@ Scope | Description
|
|
131
147
|
:-------------|:-----------
|
132
148
|
action | To search for `Burlesque::Role` that are associated with the same action.
|
133
149
|
not_action | To search for `Burlesque::Role` that are not associated with the same action.
|
134
|
-
resource | To search for `Burlesque::Role` that are linked to a resource in question
|
135
|
-
not_resource | To search for `Burlesque::Role` that are not linked to a resource in question
|
150
|
+
resource | To search for `Burlesque::Role` that are linked to a resource in question.
|
151
|
+
not_resource | To search for `Burlesque::Role` that are not linked to a resource in question.
|
136
152
|
|
137
153
|
Example:
|
138
154
|
|
@@ -180,11 +196,11 @@ es:
|
|
180
196
|
|
181
197
|
```ruby
|
182
198
|
# Provided Spanish is the default language of your app
|
183
|
-
Burlesque::Role.create(name: 'user#read' ).translate_name() ==> Leer
|
184
|
-
Burlesque::Role.create(name: 'user#create' ).translate_name() ==> Crear
|
185
|
-
Burlesque::Role.create(name: 'user#update' ).translate_name() ==> Actualizar
|
186
|
-
Burlesque::Role.create(name: 'user#destroy').translate_name() ==> Eliminar
|
187
|
-
Burlesque::Role.create(name: 'user#manage' ).translate_name() ==> Administrar
|
199
|
+
Burlesque::Role.create(name: 'user#read' ).translate_name() ==> Leer Usuario
|
200
|
+
Burlesque::Role.create(name: 'user#create' ).translate_name() ==> Crear Usuario
|
201
|
+
Burlesque::Role.create(name: 'user#update' ).translate_name() ==> Actualizar Usuario
|
202
|
+
Burlesque::Role.create(name: 'user#destroy').translate_name() ==> Eliminar Usuario
|
203
|
+
Burlesque::Role.create(name: 'user#manage' ).translate_name() ==> Administrar Usuario
|
188
204
|
```
|
189
205
|
|
190
206
|
If what you want is to change the translation of a single `Burlesque::Role`, you can:
|
@@ -201,6 +217,17 @@ Burlesque::Role.action(:read).resource(:user).translate_name() ==> Read Awesom
|
|
201
217
|
Burlesque::Role.find_by_name('user#read').translate_name() ==> Read Awesome Users
|
202
218
|
```
|
203
219
|
|
220
|
+
|
221
|
+
|
222
|
+
# RSpect & FactoryGirl testing
|
223
|
+
|
224
|
+
TODO - Define Groups and Roles factories
|
225
|
+
TODO - Use factories into User's
|
226
|
+
TODO - Testing
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
204
231
|
# Contributing
|
205
232
|
|
206
233
|
TODO
|
@@ -49,6 +49,9 @@ module Burlesque
|
|
49
49
|
rescue
|
50
50
|
translate = I18n.t(action_sym, scope: :authorizations) + ' ' + resource_class.to_s
|
51
51
|
end
|
52
|
+
|
53
|
+
return translate unless translate.include?('translation missing:')
|
54
|
+
return name
|
52
55
|
end
|
53
56
|
|
54
57
|
# Public: Entrega el recurso asociado al rol.
|
data/lib/burlesque/version.rb
CHANGED