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
68a18713
Commit
68a18713
authored
Sep 20, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grant support_bot guest access
for projects with ProjectFeature::PRIVATE
parent
fd160a2c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
0 deletions
+88
-0
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+1
-0
ee/changelogs/unreleased/31815-service-desk-email-rejections.yml
...gelogs/unreleased/31815-service-desk-email-rejections.yml
+5
-0
ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
+54
-0
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+28
-0
No files found.
ee/app/policies/ee/project_policy.rb
View file @
68a18713
...
...
@@ -275,6 +275,7 @@ module EE
def
lookup_access_level!
return
::
Gitlab
::
Access
::
NO_ACCESS
if
needs_new_sso_session?
return
::
Gitlab
::
Access
::
REPORTER
if
alert_bot?
return
::
Gitlab
::
Access
::
GUEST
if
support_bot?
&&
service_desk_enabled?
super
end
...
...
ee/changelogs/unreleased/31815-service-desk-email-rejections.yml
0 → 100644
View file @
68a18713
---
title
:
Fix replies to service desk emails for projects with issue access as Only Project Members
merge_request
:
17401
author
:
type
:
fixed
ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
View file @
68a18713
...
...
@@ -113,4 +113,58 @@ describe Gitlab::Email::Handler::CreateNoteHandler do
end
end
end
context
'when the service desk'
do
let
(
:project
)
{
create
(
:project
,
:public
,
service_desk_enabled:
true
)
}
let
(
:support_bot
)
{
User
.
support_bot
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
,
author:
support_bot
)
}
let
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
noteable
)
}
let!
(
:sent_notification
)
do
SentNotification
.
record_note
(
note
,
support_bot
.
id
,
mail_key
)
end
context
'is enabled'
do
before
do
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
and_return
(
true
)
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
with
(
project:
project
).
and_return
(
true
)
project
.
project_feature
.
update!
(
issues_access_level:
issues_access_level
)
end
context
'when issues are enabled for everyone'
do
let
(
:issues_access_level
)
{
ProjectFeature
::
ENABLED
}
it
'creates a comment'
do
expect
{
receiver
.
execute
}.
to
change
{
noteable
.
notes
.
count
}.
by
(
1
)
end
end
context
'when issues are protected members only'
do
let
(
:issues_access_level
)
{
ProjectFeature
::
PRIVATE
}
it
'creates a comment'
do
expect
{
receiver
.
execute
}.
to
change
{
noteable
.
notes
.
count
}.
by
(
1
)
end
end
context
'when issues are disabled'
do
let
(
:issues_access_level
)
{
ProjectFeature
::
DISABLED
}
it
'does not create a comment'
do
expect
{
receiver
.
execute
}.
to
raise_error
(
::
Gitlab
::
Email
::
UserNotAuthorizedError
)
end
end
end
context
'is disabled'
do
before
do
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
and_return
(
false
)
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
with
(
project:
project
).
and_return
(
false
)
end
it
'does not create a comment'
do
expect
{
receiver
.
execute
}.
to
raise_error
(
::
Gitlab
::
Email
::
ProjectNotFound
)
end
end
end
end
ee/spec/policies/project_policy_spec.rb
View file @
68a18713
...
...
@@ -924,6 +924,34 @@ describe ProjectPolicy do
end
end
context
'support bot'
do
let
(
:current_user
)
{
User
.
support_bot
}
context
'with service desk disabled'
do
it
{
expect_allowed
(
:guest_access
)
}
it
{
expect_disallowed
(
:create_note
,
:read_project
)
}
end
context
'with service desk enabled'
do
let
(
:project
)
{
create
(
:project
,
:public
,
service_desk_enabled:
true
)
}
before
do
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
and_return
(
true
)
allow
(
::
EE
::
Gitlab
::
ServiceDesk
).
to
receive
(
:enabled?
).
with
(
project:
project
).
and_return
(
true
)
end
it
{
expect_allowed
(
:guest_access
,
:create_note
,
:read_issue
)
}
context
'when issues are protected members only'
do
before
do
project
.
project_feature
.
update!
(
issues_access_level:
ProjectFeature
::
PRIVATE
)
end
it
{
expect_allowed
(
:guest_access
,
:create_note
,
:read_issue
)
}
end
end
end
context
'commit_committer_check is not enabled by the current license'
do
before
do
stub_licensed_features
(
commit_committer_check:
false
)
...
...
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