Skip to content

Commit e5d4f35

Browse files
chore: only show license expiry warning for deployment admins (coder#14488)
1 parent faf2452 commit e5d4f35

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

enterprise/coderd/coderd.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -582,26 +582,10 @@ type API struct {
582582
// This header is used by the CLI to display warnings to the user without having
583583
// to make additional requests!
584584
func (api *API) writeEntitlementWarningsHeader(a rbac.Subject, header http.Header) {
585-
roles, err := a.Roles.Expand()
585+
err := api.AGPL.HTTPAuth.Authorizer.Authorize(api.ctx, a, policy.ActionRead, rbac.ResourceDeploymentConfig)
586586
if err != nil {
587587
return
588588
}
589-
nonMemberRoles := 0
590-
for _, role := range roles {
591-
// The member role is implied, and not assignable.
592-
// If there is no display name, then the role is also unassigned.
593-
// This is not the ideal logic, but works for now.
594-
if role.Identifier == rbac.RoleMember() || (role.DisplayName == "") {
595-
continue
596-
}
597-
nonMemberRoles++
598-
}
599-
if nonMemberRoles == 0 {
600-
// Don't show entitlement warnings if the user
601-
// has no roles. This is a normal user!
602-
return
603-
}
604-
605589
api.Entitlements.WriteEntitlementWarningHeaders(header)
606590
}
607591

0 commit comments

Comments
 (0)