Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions depot/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,6 @@ func RequestTokenExists(c *gin.Context) bool {
return exists
}

func RequestTokenHasScope(c *gin.Context, scope string) bool {
for _, tokenScope := range strings.Fields(GetRequestTokenScopes(c)) {
if tokenScope == scope {
return true
}
}
return false
}

func RequestTokenHasGroupName(c *gin.Context, groupName string) bool {
for _, tokenGroup := range GetRequestTokenGroupNames(c) {
if tokenGroup == groupName {
Expand Down Expand Up @@ -209,14 +200,10 @@ const AdminGroupName = "DepotAdmins"
// the token must have been minted for Depot's own OAuth client, and its entity
// must belong to the DepotAdmins group. An application token can never
// reshape Depot regardless of what its entity's group memberships say.
// sentinel:all remains as first-party break-glass for Sentinel's own tooling.
func RequestTokenIsAdmin(c *gin.Context) bool {
if !RequestTokenExists(c) {
return false
}
if RequestTokenHasScope(c, "sentinel:all") {
return true
}
return RequestTokenIsFirstParty(c) && RequestTokenHasGroupName(c, AdminGroupName)
}

Expand Down
Loading