diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-04-27 16:40:27 -0400 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-04-27 16:40:27 -0400 |
commit | 57f8be4e69acea24456758d2888e0f703a2dfba9 (patch) | |
tree | dacb22153c3e72321161ebf2e5fc438e1e942a95 /app/serializers | |
parent | 5976195fef53fe1bc56647dfc06049a8f984d5fe (diff) | |
parent | 703df2881bb137a79284baafe2cc12ff32ab9ff5 (diff) | |
download | gitlab-ce-57f8be4e69acea24456758d2888e0f703a2dfba9.tar.gz |
Merge remote-tracking branch 'origin/29667-deploy-keys' into deploy-keys-load-async
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/deploy_key_entity.rb | 14 | ||||
-rw-r--r-- | app/serializers/deploy_key_serializer.rb | 3 | ||||
-rw-r--r-- | app/serializers/project_entity.rb | 12 |
3 files changed, 29 insertions, 0 deletions
diff --git a/app/serializers/deploy_key_entity.rb b/app/serializers/deploy_key_entity.rb new file mode 100644 index 00000000000..d75a83d0fa5 --- /dev/null +++ b/app/serializers/deploy_key_entity.rb @@ -0,0 +1,14 @@ +class DeployKeyEntity < Grape::Entity + expose :id + expose :user_id + expose :title + expose :fingerprint + expose :can_push + expose :destroyed_when_orphaned?, as: :destroyed_when_orphaned + expose :almost_orphaned?, as: :almost_orphaned + expose :created_at + expose :updated_at + expose :projects, using: ProjectEntity do |deploy_key| + deploy_key.projects.select { |project| options[:user].can?(:read_project, project) } + end +end diff --git a/app/serializers/deploy_key_serializer.rb b/app/serializers/deploy_key_serializer.rb new file mode 100644 index 00000000000..8f849eb88b7 --- /dev/null +++ b/app/serializers/deploy_key_serializer.rb @@ -0,0 +1,3 @@ +class DeployKeySerializer < BaseSerializer + entity DeployKeyEntity +end diff --git a/app/serializers/project_entity.rb b/app/serializers/project_entity.rb new file mode 100644 index 00000000000..6f8061f7530 --- /dev/null +++ b/app/serializers/project_entity.rb @@ -0,0 +1,12 @@ +class ProjectEntity < Grape::Entity + expose :id + expose :name + + expose :full_path do |project| + project.full_path + end + + expose :full_name do |project| + project.full_name + end +end |