Skip to content

Commit 5545c0d

Browse files
committed
chore: only show license expiry warning for deployment admins
1 parent 6287502 commit 5545c0d

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

enterprise/coderd/coderd.go

+1-17
Original file line numberDiff line numberDiff line change
@@ -573,26 +573,10 @@ type API struct {
573573
// This header is used by the CLI to display warnings to the user without having
574574
// to make additional requests!
575575
func (api *API) writeEntitlementWarningsHeader(a rbac.Subject, header http.Header) {
576-
roles, err := a.Roles.Expand()
576+
err := api.AGPL.HTTPAuth.Authorizer.Authorize(api.ctx, a, policy.ActionRead, rbac.ResourceDeploymentConfig)
577577
if err != nil {
578578
return
579579
}
580-
nonMemberRoles := 0
581-
for _, role := range roles {
582-
// The member role is implied, and not assignable.
583-
// If there is no display name, then the role is also unassigned.
584-
// This is not the ideal logic, but works for now.
585-
if role.Identifier == rbac.RoleMember() || (role.DisplayName == "") {
586-
continue
587-
}
588-
nonMemberRoles++
589-
}
590-
if nonMemberRoles == 0 {
591-
// Don't show entitlement warnings if the user
592-
// has no roles. This is a normal user!
593-
return
594-
}
595-
596580
api.Entitlements.WriteEntitlementWarningHeaders(header)
597581
}
598582

0 commit comments

Comments
 (0)