| 977 | } |
| 978 | |
| 979 | func update[ |
| 980 | ObjectType rbac.Objecter, |
| 981 | ArgumentType any, |
| 982 | Fetch func(ctx context.Context, arg ArgumentType) (ObjectType, error), |
| 983 | Exec func(ctx context.Context, arg ArgumentType) error, |
| 984 | ]( |
| 985 | logger slog.Logger, |
| 986 | authorizer rbac.Authorizer, |
| 987 | fetchFunc Fetch, |
| 988 | updateExec Exec, |
| 989 | ) Exec { |
| 990 | return fetchAndExec(logger, authorizer, policy.ActionUpdate, fetchFunc, updateExec) |
| 991 | } |
| 992 | |
| 993 | // fetch is a generic function that wraps a database |
| 994 | // query function (returns an object and an error) with authorization. The |