Commit 7c610b48 authored by Ruben Davila's avatar Ruben Davila

Expose add-ons associated to the license in /license endpoint.

parent 4520714d
......@@ -19,7 +19,10 @@ GET /license
"Email": "john@doe.com"
},
"user_limit": 100,
"active_users": 60
"active_users": 60,
"add_ons": {
"GitLab_FileLocks": 100
}
}
```
......@@ -49,7 +52,10 @@ Example response:
"Email": "john@doe.com"
},
"user_limit": 100,
"active_users": 60
"active_users": 60,
"add_ons": {
"GitLab_FileLocks": 100
}
}
```
......
......@@ -583,7 +583,7 @@ module API
end
class License < Grape::Entity
expose :starts_at, :expires_at, :licensee
expose :starts_at, :expires_at, :licensee, :add_ons
expose :user_limit do |license, options|
license.restricted?(:active_user_count) ? license.restrictions[:active_user_count] : 0
......
......@@ -5,6 +5,9 @@ FactoryGirl.define do
licensee do
{ "Name" => FFaker::Name.name }
end
restrictions do
{ add_ons: { 'GitLab_FileLocks' => 1 } }
end
notify_users_at { |l| l.expires_at }
notify_admins_at { |l| l.expires_at }
end
......
......@@ -17,6 +17,7 @@ describe API::API, api: true do
expect(Date.parse(json_response['expires_at'])).to eq Date.today + 11.months
expect(json_response['active_users']).to eq 1
expect(json_response['licensee']).not_to be_empty
expect(json_response['add_ons']).to eq({ 'GitLab_FileLocks' => 1 })
end
it 'denies access if not admin' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment