Don't allow users to delete builtin roles

This commit is contained in:
Abin Simon
2022-04-14 16:24:44 +05:30
parent d89136de65
commit 5537cf0608
+3
View File
@@ -315,6 +315,9 @@ func (s *roleService) Delete(ctx context.Context, role *rolev3.Role) (*rolev3.Ro
}
if rle, ok := entity.(*models.Role); ok {
if rle.Builtin {
return role, fmt.Errorf("builtin role '%v' cannot be deleted", name)
}
tx, err := s.db.BeginTx(ctx, &sql.TxOptions{})
if err != nil {