Some changes in groups.

This commit is contained in:
George Vinogradov 2011-12-07 03:45:09 +04:00
parent 97579f8534
commit 0bffb0581e
5 changed files with 13 additions and 4 deletions

View File

@ -11,7 +11,7 @@ class PersonalRepositoriesController < ApplicationController
else
@projects = @repository.projects.recent.paginate :page => params[:project_page], :per_page => 30
end
@user = @repository.owner
@urpmi_commands = @repository.platform.urpmi_list(request.host)
end

View File

@ -25,7 +25,7 @@ class ProjectsController < ApplicationController
end.paginate(:page => params[:project_page])
@own_projects = current_user.own_projects
@part_projects = current_user.projects - @own_projects
@part_projects = current_user.projects + current_user.groups.map(&:projects).flatten.uniq - @own_projects
end
def show

View File

@ -34,7 +34,6 @@ class Ability
can :manage_collaborators, Project do |project|
project.relations.exists? :object_id => user.id, :object_type => 'User', :role => 'admin'
end
can :manage_members, Group do |group|
group.objects.exists? :object_id => user.id, :object_type => 'User', :role => 'admin'
end
@ -102,6 +101,10 @@ class Ability
build_list.can_published? && build_list.project.relations.exists?(:object_type => 'Group', :object_id => user.group_ids)
end
can :manage_collaborators, Project, projects_in_relations_with(:role => 'admin', :object_type => 'Group', :object_id => user.group_ids) do |project|
project.relations.exists? :object_id => user.group_ids, :object_type => 'Group', :role => 'admin'
end
can [:read, :update, :process_build, :build, :destroy], Project, :owner_type => 'Group', :owner_id => user.group_ids
#can :read, Project, :relations => {:role => 'reader', :object_type => 'Group', :object_id => user.group_ids}
can :read, Project, projects_in_relations_with(:role => 'reader', :object_type => 'Group', :object_id => user.group_ids) do |project|

View File

@ -34,4 +34,4 @@
= will_paginate @projects, :param_name => :project_page
-# content_for :sidebar, render(:partial => 'sidebar')
- content_for :sidebar, render(:partial => 'shared/user_groups_sidebar')

View File

@ -0,0 +1,6 @@
.block.notice
%h3= t("layout.users.groups")
.content
- @user.groups.each do |group|
%p= link_to group.name, group