Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
27a7f3cb
Verified
Commit
27a7f3cb
authored
4 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: remove unused functions
parent
855acaee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/v1/utils.go
+0
-58
0 additions, 58 deletions
api/v1/utils.go
store/files.go
+0
-8
0 additions, 8 deletions
store/files.go
with
0 additions
and
66 deletions
api/v1/utils.go
+
0
−
58
View file @
27a7f3cb
...
...
@@ -135,23 +135,6 @@ func isRequestReadOnly(c *gin.Context) bool {
return
false
}
func
authorizeRequestAllShows
(
c
*
gin
.
Context
)
(
bool
,
*
auth
.
Session
)
{
s
:=
getAuthSession
(
c
.
Request
)
if
s
.
Privileged
{
return
true
,
s
}
if
s
.
ReadOnly
&&
!
isRequestReadOnly
(
c
)
{
c
.
JSON
(
http
.
StatusForbidden
,
ErrorResponse
{
Error
:
"this session is read-only"
})
return
false
,
s
}
if
s
.
AllShows
{
return
true
,
s
}
c
.
JSON
(
http
.
StatusForbidden
,
ErrorResponse
{
Error
:
"you are not allowed to access all shows"
})
return
false
,
s
}
func
authorizeRequestForShow
(
c
*
gin
.
Context
,
showID
uint64
)
(
bool
,
*
auth
.
Session
)
{
s
:=
getAuthSession
(
c
.
Request
)
if
s
.
Privileged
{
...
...
@@ -181,47 +164,6 @@ func authorizeRequestForShow(c *gin.Context, showID uint64) (bool, *auth.Session
return
false
,
s
}
func
authorizeRequestForPlaylist
(
c
*
gin
.
Context
,
playlistID
uint64
,
api
*
API
)
(
bool
,
*
auth
.
Session
)
{
s
:=
getAuthSession
(
c
.
Request
)
if
s
.
Privileged
{
return
true
,
s
}
if
s
.
ReadOnly
&&
!
isRequestReadOnly
(
c
)
{
c
.
JSON
(
http
.
StatusForbidden
,
ErrorResponse
{
Error
:
"this session is read-only"
})
return
false
,
s
}
if
s
.
AllShows
{
return
true
,
s
}
// query the database to get the showId and check if it’s listed in the session
if
showID
,
err
:=
api
.
store
.
GetPlaylistShowID
(
playlistID
);
err
!=
nil
{
if
slices
.
Contains
(
s
.
Shows
,
showID
)
{
return
true
,
s
}
}
c
.
JSON
(
http
.
StatusForbidden
,
ErrorResponse
{
Error
:
"you are not allowed to access playlist: "
+
strconv
.
FormatUint
(
playlistID
,
10
)})
return
false
,
s
}
func
authorizeRequest
(
c
*
gin
.
Context
,
api
*
API
)
(
bool
,
*
auth
.
Session
)
{
// showId is passed as query parameter
if
showID
,
_
:=
idFromString
(
c
.
Query
(
"showId"
));
showID
!=
0
{
return
authorizeRequestForShow
(
c
,
showID
)
}
// playlist-id is passed as url parameter
if
playlistID
,
_
:=
idFromString
(
c
.
Param
(
"playlist-id"
));
playlistID
!=
0
{
return
authorizeRequestForPlaylist
(
c
,
playlistID
,
api
)
}
return
authorizeRequestAllShows
(
c
)
}
func
authorizeRequestPrivilegedOrEntitled
(
c
*
gin
.
Context
)
(
bool
,
*
auth
.
Session
)
{
s
:=
getAuthSession
(
c
.
Request
)
...
...
This diff is collapsed.
Click to expand it.
store/files.go
+
0
−
8
View file @
27a7f3cb
...
...
@@ -124,14 +124,6 @@ func (st *Store) UpdateFileMetadata(showID uint64, id uint64, metadata map[strin
return
}
func
(
st
*
Store
)
updateFile
(
showID
uint64
,
id
uint64
,
values
...
interface
{})
(
file
*
File
,
err
error
)
{
file
=
&
File
{
ID
:
id
}
if
err
=
st
.
db
.
Model
(
&
file
)
.
Where
(
"show_id = ?"
,
showID
)
.
Updates
(
values
)
.
Error
;
err
!=
nil
{
return
nil
,
err
}
return
file
,
nil
}
func
(
st
*
Store
)
updateImportState
(
showID
uint64
,
id
uint64
,
state
ImportState
)
(
file
*
File
,
err
error
)
{
file
=
&
File
{
ID
:
id
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment