diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 10:40:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 10:40:32 +0000 |
commit | dd9c2cafa795ec00875981dcedd3287d2d005457 (patch) | |
tree | 4d540a76dc06fb4d530bb5804d3676fa366489d7 /app/views/groups | |
parent | 3142183b3052b520126645eaec01526810e2afff (diff) | |
download | redmine-dd9c2cafa795ec00875981dcedd3287d2d005457.tar.gz redmine-dd9c2cafa795ec00875981dcedd3287d2d005457.zip |
REST Api for Groups (#8981).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9758 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/groups')
-rw-r--r-- | app/views/groups/index.api.rsb | 10 | ||||
-rw-r--r-- | app/views/groups/show.api.rsb | 30 |
2 files changed, 40 insertions, 0 deletions
diff --git a/app/views/groups/index.api.rsb b/app/views/groups/index.api.rsb new file mode 100644 index 000000000..6a4efeaf7 --- /dev/null +++ b/app/views/groups/index.api.rsb @@ -0,0 +1,10 @@ +api.array :groups do + @groups.each do |group| + api.group do + api.id group.id + api.name group.lastname + + render_api_custom_values group.visible_custom_field_values, api + end + end +end diff --git a/app/views/groups/show.api.rsb b/app/views/groups/show.api.rsb new file mode 100644 index 000000000..764bdceda --- /dev/null +++ b/app/views/groups/show.api.rsb @@ -0,0 +1,30 @@ +api.group do + api.id @group.id + api.name @group.lastname + + render_api_custom_values @group.visible_custom_field_values, api + + api.array :users do + @group.users.each do |user| + api.user :id => user.id, :name => user.name + end + end + + api.array :memberships do + @group.memberships.each do |membership| + api.membership do + api.id membership.id + api.project :id => membership.project.id, :name => membership.project.name + api.array :roles do + membership.member_roles.each do |member_role| + if member_role.role + attrs = {:id => member_role.role.id, :name => member_role.role.name} + attrs.merge!(:inherited => true) if member_role.inherited_from.present? + api.role attrs + end + end + end + end if membership.project + end + end if include_in_api_response?('memberships') +end |