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
c6dbd435
Commit
c6dbd435
authored
Jul 27, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the module and add a simple test to check
if all methods are also presented in the user.
parent
02732e85
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
4 deletions
+17
-4
app/models/deploy_token.rb
app/models/deploy_token.rb
+1
-1
app/policies/concerns/policy_actor.rb
app/policies/concerns/policy_actor.rb
+2
-2
ee/app/policies/ee/policy_actor.rb
ee/app/policies/ee/policy_actor.rb
+1
-1
spec/policies/concerns/policy_actor_spec.rb
spec/policies/concerns/policy_actor_spec.rb
+13
-0
No files found.
app/models/deploy_token.rb
View file @
c6dbd435
class
DeployToken
<
ActiveRecord
::
Base
class
DeployToken
<
ActiveRecord
::
Base
include
Expirable
include
Expirable
include
TokenAuthenticatable
include
TokenAuthenticatable
include
Policy
Checkable
include
Policy
Actor
add_authentication_token_field
:token
add_authentication_token_field
:token
AVAILABLE_SCOPES
=
%i(read_repository read_registry)
.
freeze
AVAILABLE_SCOPES
=
%i(read_repository read_registry)
.
freeze
...
...
app/policies/concerns/policy_
checkable
.rb
→
app/policies/concerns/policy_
actor
.rb
View file @
c6dbd435
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
# Include this module if we want to pass something else than the user to
# Include this module if we want to pass something else than the user to
# check policies. This defines several methods which the policy checker
# check policies. This defines several methods which the policy checker
# would call and check.
# would call and check.
module
Policy
Checkable
module
Policy
Actor
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepend
EE
::
Policy
Checkable
prepend
EE
::
Policy
Actor
def
blocked?
def
blocked?
false
false
...
...
ee/app/policies/ee/policy_
checkable
.rb
→
ee/app/policies/ee/policy_
actor
.rb
View file @
c6dbd435
# frozen_string_literal: true
# frozen_string_literal: true
module
EE
module
EE
module
Policy
Checkable
module
Policy
Actor
def
auditor?
def
auditor?
false
false
end
end
...
...
spec/policies/concerns/policy_actor_spec.rb
0 → 100644
View file @
c6dbd435
# frozen_string_literal: true
require
'spec_helper'
describe
PolicyActor
do
it
'implements all the methods from user'
do
methods
=
subject
.
instance_methods
# User.instance_methods do not return all methods until an instance is
# initialized. So here we just use an instance
expect
(
build
(
:user
).
methods
).
to
include
(
*
methods
)
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