Commit ffbaefb9b788d0fa89306153aabb9c0e4e4b9f21
Committed by
Antonio Terceiro
1 parent
36e56c4d
Exists in
master
and in
28 other branches
Only correct roles a showed to organization's members
* The available roles for organization's members are: * Profile Administrator * Moderator * Member * Local roles aren't being considered because they're not working correctly until now. (ActionItem1382)
Showing
2 changed files
with
4 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/profile_members_controller.rb
@@ -20,7 +20,7 @@ class ProfileMembersController < MyProfileController | @@ -20,7 +20,7 @@ class ProfileMembersController < MyProfileController | ||
20 | end | 20 | end |
21 | 21 | ||
22 | def change_role | 22 | def change_role |
23 | - @roles = profile.roles | 23 | + @roles = Profile::Roles.organization_member_roles(environment.id) |
24 | @member = profile.members.find { |m| m.id == params[:id].to_i } | 24 | @member = profile.members.find { |m| m.id == params[:id].to_i } |
25 | if @member | 25 | if @member |
26 | @associations = @member.find_roles(@profile) | 26 | @associations = @member.find_roles(@profile) |
app/models/profile.rb
@@ -19,6 +19,9 @@ class Profile < ActiveRecord::Base | @@ -19,6 +19,9 @@ class Profile < ActiveRecord::Base | ||
19 | def self.editor(env_id) | 19 | def self.editor(env_id) |
20 | find_role('editor', env_id) | 20 | find_role('editor', env_id) |
21 | end | 21 | end |
22 | + def self.organization_member_roles(env_id) | ||
23 | + [admin(env_id), moderator(env_id), member(env_id)] | ||
24 | + end | ||
22 | def self.all_roles(env_id) | 25 | def self.all_roles(env_id) |
23 | [admin(env_id), member(env_id), moderator(env_id), owner(env_id), editor(env_id)] | 26 | [admin(env_id), member(env_id), moderator(env_id), owner(env_id), editor(env_id)] |
24 | end | 27 | end |