mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
chore: implement deleting custom roles (#14101)
* chore: implement deleting custom roles * add trigger to delete role from organization members on delete * chore: add comments to explain populated field
This commit is contained in:
@@ -106,12 +106,24 @@ func Is404Error(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// This tests for dbauthz.IsNotAuthorizedError and rbac.IsUnauthorizedError.
|
||||
if IsUnauthorizedError(err) {
|
||||
return true
|
||||
}
|
||||
return xerrors.Is(err, sql.ErrNoRows)
|
||||
}
|
||||
|
||||
func IsUnauthorizedError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// This tests for dbauthz.IsNotAuthorizedError and rbac.IsUnauthorizedError.
|
||||
var unauthorized httpapiconstraints.IsUnauthorizedError
|
||||
if errors.As(err, &unauthorized) && unauthorized.IsUnauthorized() {
|
||||
return true
|
||||
}
|
||||
return xerrors.Is(err, sql.ErrNoRows)
|
||||
return false
|
||||
}
|
||||
|
||||
// Convenience error functions don't take contexts since their responses are
|
||||
|
||||
Reference in New Issue
Block a user