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
263ab502
Commit
263ab502
authored
Dec 20, 2019
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor can_admin_namespace ability allowed
parent
d6e64fd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+4
-2
No files found.
ee/lib/ee/api/entities.rb
View file @
263ab502
...
@@ -148,15 +148,17 @@ module EE
...
@@ -148,15 +148,17 @@ module EE
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepended
do
prepended
do
can_admin_namespace
=
->
(
namespace
,
opts
)
{
::
Ability
.
allowed?
(
opts
[
:current_user
],
:admin_namespace
,
namespace
)
}
expose
:shared_runners_minutes_limit
,
if:
->
(
_
,
options
)
{
options
[
:current_user
]
&
.
admin?
}
expose
:shared_runners_minutes_limit
,
if:
->
(
_
,
options
)
{
options
[
:current_user
]
&
.
admin?
}
expose
:extra_shared_runners_minutes_limit
,
if:
->
(
_
,
options
)
{
options
[
:current_user
]
&
.
admin?
}
expose
:extra_shared_runners_minutes_limit
,
if:
->
(
_
,
options
)
{
options
[
:current_user
]
&
.
admin?
}
expose
:billable_members_count
do
|
namespace
,
options
|
expose
:billable_members_count
do
|
namespace
,
options
|
namespace
.
billable_members_count
(
options
[
:requested_hosted_plan
])
namespace
.
billable_members_count
(
options
[
:requested_hosted_plan
])
end
end
expose
:plan
,
if:
->
(
namespace
,
opts
)
{
::
Ability
.
allowed?
(
opts
[
:current_user
],
:admin_namespace
,
namespace
)
}
do
|
namespace
,
_
|
expose
:plan
,
if:
can_admin_namespace
do
|
namespace
,
_
|
namespace
.
actual_plan_name
namespace
.
actual_plan_name
end
end
expose
:trial_ends_on
,
if:
->
(
namespace
,
opts
)
{
::
Ability
.
allowed?
(
opts
[
:current_user
],
:admin_namespace
,
namespace
)
}
do
|
namespace
,
_
|
expose
:trial_ends_on
,
if:
can_admin_namespace
do
|
namespace
,
_
|
namespace
.
trial_ends_on
namespace
.
trial_ends_on
end
end
end
end
...
...
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