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
86251eb3
Commit
86251eb3
authored
Feb 24, 2021
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand logs of authorized projects refresh
parent
2c3ae4c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
app/services/users/refresh_authorized_projects_service.rb
app/services/users/refresh_authorized_projects_service.rb
+9
-4
spec/services/users/refresh_authorized_projects_service_spec.rb
...ervices/users/refresh_authorized_projects_service_spec.rb
+6
-2
No files found.
app/services/users/refresh_authorized_projects_service.rb
View file @
86251eb3
...
...
@@ -92,7 +92,7 @@ module Users
# remove - The IDs of the authorization rows to remove.
# add - Rows to insert in the form `[user id, project id, access level]`
def
update_authorizations
(
remove
=
[],
add
=
[])
log_refresh_details
(
remove
.
length
,
add
.
length
)
log_refresh_details
(
remove
,
add
)
User
.
transaction
do
user
.
remove_project_authorizations
(
remove
)
unless
remove
.
empty?
...
...
@@ -104,11 +104,16 @@ module Users
user
.
reset
end
def
log_refresh_details
(
r
ows_deleted
,
rows_adde
d
)
def
log_refresh_details
(
r
emove
,
ad
d
)
Gitlab
::
AppJsonLogger
.
info
(
event:
'authorized_projects_refresh'
,
user_id:
user
.
id
,
'authorized_projects_refresh.source'
:
source
,
'authorized_projects_refresh.rows_deleted'
:
rows_deleted
,
'authorized_projects_refresh.rows_added'
:
rows_added
)
'authorized_projects_refresh.rows_deleted_count'
:
remove
.
length
,
'authorized_projects_refresh.rows_added_count'
:
add
.
length
,
# most often there's only a few entries in remove and add, but limit it to the first 5
# entries to avoid flooding the logs
'authorized_projects_refresh.rows_deleted_slice'
:
remove
.
first
(
5
),
'authorized_projects_refresh.rows_added_slice'
:
add
.
first
(
5
))
end
def
fresh_access_levels_per_project
...
...
spec/services/users/refresh_authorized_projects_service_spec.rb
View file @
86251eb3
...
...
@@ -152,9 +152,13 @@ RSpec.describe Users::RefreshAuthorizedProjectsService do
expect
(
Gitlab
::
AppJsonLogger
).
to
(
receive
(
:info
)
.
with
(
event:
'authorized_projects_refresh'
,
user_id:
user
.
id
,
'authorized_projects_refresh.source'
:
source
,
'authorized_projects_refresh.rows_deleted'
:
0
,
'authorized_projects_refresh.rows_added'
:
1
))
'authorized_projects_refresh.rows_deleted_count'
:
0
,
'authorized_projects_refresh.rows_added_count'
:
1
,
'authorized_projects_refresh.rows_deleted_slice'
:
[],
'authorized_projects_refresh.rows_added_slice'
:
[[
user
.
id
,
project
.
id
,
Gitlab
::
Access
::
MAINTAINER
]])
)
service
.
update_authorizations
([],
[[
user
.
id
,
project
.
id
,
Gitlab
::
Access
::
MAINTAINER
]])
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