Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7c610b48
Commit
7c610b48
authored
Nov 30, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose add-ons associated to the license in /license endpoint.
parent
4520714d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
doc/api/license.md
doc/api/license.md
+8
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/factories/licenses.rb
spec/factories/licenses.rb
+3
-0
spec/requests/api/license_spec.rb
spec/requests/api/license_spec.rb
+1
-0
No files found.
doc/api/license.md
View file @
7c610b48
...
...
@@ -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
}
}
```
...
...
lib/api/entities.rb
View file @
7c610b48
...
...
@@ -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
...
...
spec/factories/licenses.rb
View file @
7c610b48
...
...
@@ -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
...
...
spec/requests/api/license_spec.rb
View file @
7c610b48
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment