Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
c38404b5
Commit
c38404b5
authored
Jan 21, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: tweak get memo by name
parent
4d48f508
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
acl_config.go
api/v2/acl_config.go
+1
-0
memo_service.go
api/v2/memo_service.go
+12
-0
No files found.
api/v2/acl_config.go
View file @
c38404b5
...
@@ -8,6 +8,7 @@ var authenticationAllowlistMethods = map[string]bool{
...
@@ -8,6 +8,7 @@ var authenticationAllowlistMethods = map[string]bool{
"/memos.api.v2.UserService/GetUser"
:
true
,
"/memos.api.v2.UserService/GetUser"
:
true
,
"/memos.api.v2.MemoService/ListMemos"
:
true
,
"/memos.api.v2.MemoService/ListMemos"
:
true
,
"/memos.api.v2.MemoService/GetMemo"
:
true
,
"/memos.api.v2.MemoService/GetMemo"
:
true
,
"/memos.api.v2.MemoService/GetMemoByName"
:
true
,
"/memos.api.v2.MemoService/ListMemoResources"
:
true
,
"/memos.api.v2.MemoService/ListMemoResources"
:
true
,
"/memos.api.v2.MemoService/ListMemoRelations"
:
true
,
"/memos.api.v2.MemoService/ListMemoRelations"
:
true
,
"/memos.api.v2.MemoService/ListMemoComments"
:
true
,
"/memos.api.v2.MemoService/ListMemoComments"
:
true
,
...
...
api/v2/memo_service.go
View file @
c38404b5
...
@@ -247,6 +247,18 @@ func (s *APIV2Service) GetMemoByName(ctx context.Context, request *apiv2pb.GetMe
...
@@ -247,6 +247,18 @@ func (s *APIV2Service) GetMemoByName(ctx context.Context, request *apiv2pb.GetMe
if
memo
==
nil
{
if
memo
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"memo not found"
)
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"memo not found"
)
}
}
if
memo
.
Visibility
!=
store
.
Public
{
user
,
err
:=
getCurrentUser
(
ctx
,
s
.
Store
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to get user"
)
}
if
user
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
if
memo
.
Visibility
==
store
.
Private
&&
memo
.
CreatorID
!=
user
.
ID
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
}
memoMessage
,
err
:=
s
.
convertMemoFromStore
(
ctx
,
memo
)
memoMessage
,
err
:=
s
.
convertMemoFromStore
(
ctx
,
memo
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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