curupira 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of curupira might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/curupira/users_controller.rb +6 -0
- data/app/views/curupira/users/_group_user_fields.html.erb +1 -10
- data/app/views/curupira/users/_role_group_user_fields.html.erb +1 -1
- data/app/views/curupira/users/permission.html.erb +20 -0
- data/app/views/curupira/users/show.html.erb +1 -1
- data/lib/curupira/rails/routes.rb +4 -1
- data/lib/curupira/version.rb +1 -1
- data/lib/generators/curupira/install/model_generators_helper.rb +1 -0
- data/spec/dummy/app/models/user.rb +1 -0
- data/spec/dummy/log/test.log +25971 -0
- data/spec/generators/curupira/install/install_generators_spec.rb +2 -0
- data/spec/tmp/app/models/user.rb +1 -0
- data/spec/tmp/db/migrate/{20150320032239_create_role_group_users.rb → 20150323194119_create_role_group_users.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032240_create_authorizations.rb → 20150323194120_create_authorizations.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032241_create_features.rb → 20150323194121_create_features.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032242_create_groups.rb → 20150323194122_create_groups.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032243_create_roles.rb → 20150323194123_create_roles.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032244_sorcery_core.rb → 20150323194124_sorcery_core.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032245_create_group_users.rb → 20150323194125_create_group_users.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032246_create_role_groups.rb → 20150323194126_create_role_groups.rb} +0 -0
- data/spec/tmp/db/migrate/{20150320032247_create_action_labels.rb → 20150323194127_create_action_labels.rb} +0 -0
- metadata +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca4be82e390515697d16daa359b5a036d5d7189
|
4
|
+
data.tar.gz: 49744e964b4f0572f47371659ae0cba69b503237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21fc605d450e4b1ec20d09e7014c29a7516b328efb814f442a187db99c0aaa1bff6b341cb14bcd8750351c8939c598d820adb93767008b27b26cecf25ccaf8e1
|
7
|
+
data.tar.gz: a8416b6983a96add5385eb7cb806442ad6d5878e1f5e7cff48260c9abec3ab94db3cbe2d90d976b87444d5336a9e298156358424302442edd26a9aaf234c8ba5
|
data/Gemfile.lock
CHANGED
@@ -39,6 +39,12 @@ class Curupira::UsersController < Curupira::AuthorizedController
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def permission
|
43
|
+
@user = User.find(params[:user_id])
|
44
|
+
@group_user = @user.group_users.find_by(group_id: params[:group_id])
|
45
|
+
@group = @group_user.group
|
46
|
+
end
|
47
|
+
|
42
48
|
private
|
43
49
|
|
44
50
|
def user_params
|
@@ -4,17 +4,8 @@
|
|
4
4
|
<% else %>
|
5
5
|
<%= f.object.user_group.name %>
|
6
6
|
<% end %>
|
7
|
-
|
8
|
-
<div style="margin: 50px">
|
9
|
-
<h4>Perfis</h4>
|
10
|
-
<%= f.fields_for :role_group_users do |role_group_user| %>
|
11
|
-
<%= render "role_group_user_fields", f: role_group_user %>
|
12
|
-
<% end %>
|
13
7
|
|
14
|
-
|
15
|
-
<%= link_to_add_association 'Adicionar Permissão', f, :role_group_users %>
|
16
|
-
</div>
|
17
|
-
|
8
|
+
<div class="links">
|
18
9
|
<%= link_to_remove_association "Remover", f %>
|
19
10
|
</div>
|
20
11
|
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h2> Adicionar perfis ao Usuário </h2>
|
2
|
+
|
3
|
+
Usuário <%= @user.name %>
|
4
|
+
|
5
|
+
Grupo <%= @group.name %>
|
6
|
+
|
7
|
+
<%= form_for @user do |f| %>
|
8
|
+
<div class="group_users">
|
9
|
+
<h3>Perfil</h3>
|
10
|
+
|
11
|
+
<%= f.fields_for :role_group_users do |b| %>
|
12
|
+
<%= render "role_group_user_fields", f: b %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="links">
|
16
|
+
<%= link_to_add_association 'Adicionar perfil', f, :role_group_users %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
<ul>
|
18
18
|
<% @user.group_users.each do |group_user| %>
|
19
|
-
<li><%= group_user.group.name %> <%= link_to "
|
19
|
+
<li><%= group_user.group.name %> <%= link_to "Vincular perfis do grupo", user_permission_path(@user,group_user.group) %>
|
20
20
|
<% group_user.role_group_users.each do |role_group_user|%>
|
21
21
|
<p><%= role_group_user.role.name %></p>
|
22
22
|
<% end %>
|
@@ -2,7 +2,10 @@ module ActionDispatch::Routing
|
|
2
2
|
class Mapper
|
3
3
|
def curupira_routes
|
4
4
|
scope module: 'curupira' do
|
5
|
-
resources :users, except: :destroy
|
5
|
+
resources :users, except: :destroy do
|
6
|
+
get 'groups/:group_id/roles', to: 'users#permission',as: 'permission', action: :permission, controller: :users
|
7
|
+
end
|
8
|
+
|
6
9
|
resources :groups, except: :destroy
|
7
10
|
resources :roles, except: :destroy
|
8
11
|
resource :session, only: [:new, :create] do
|
data/lib/curupira/version.rb
CHANGED
@@ -174,6 +174,7 @@ module Curupira
|
|
174
174
|
has_many :groups, through: :group_users
|
175
175
|
has_many :role_group_users, through: :group_users
|
176
176
|
accepts_nested_attributes_for :group_users, reject_if: :all_blank, allow_destroy: :true
|
177
|
+
accepts_nested_attributes_for :role_group_users, reject_if: :all_blank, allow_destroy: :true
|
177
178
|
|
178
179
|
scope :all_belonging_to, -> (user) { includes(group_users: :group).where(groups: { id: user.groups }) }
|
179
180
|
CONTENT
|
@@ -5,6 +5,7 @@ class User < ActiveRecord::Base
|
|
5
5
|
has_many :groups, through: :group_users
|
6
6
|
has_many :role_group_users, through: :group_users
|
7
7
|
accepts_nested_attributes_for :group_users, reject_if: :all_blank, allow_destroy: :true
|
8
|
+
accepts_nested_attributes_for :role_group_users, reject_if: :all_blank, allow_destroy: :true
|
8
9
|
|
9
10
|
scope :all_belonging_to, -> (user) { includes(group_users: :group).where(groups: { id: user.groups }) }
|
10
11
|
end
|