From 2ecfd7b0419d8b159c84dd9dfd7187fdcf6551e0 Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@lyda.ie> Date: Wed, 21 May 2025 09:13:13 +0100 Subject: [PATCH] Gatekeep those new SET commands --- repl/set.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repl/set.go b/repl/set.go index ae87712..b41e963 100644 --- a/repl/set.go +++ b/repl/set.go @@ -69,6 +69,9 @@ func ActionSetNobrief(_ *dclish.Command) error { // ActionSetDefaultExpire handles the `SET DEFAULT_EXPIRE` command. func ActionSetDefaultExpire(cmd *dclish.Command) error { + if this.User.Admin == 0 { + return errors.New("You are not an admin") + } value, err := strconv.ParseInt(cmd.Args[0], 10, 64) if err != nil { return err @@ -79,7 +82,9 @@ func ActionSetDefaultExpire(cmd *dclish.Command) error { // ActionSetExpireLimit handles the `SET EXPIRE_LIMIT` command. func ActionSetExpireLimit(cmd *dclish.Command) error { - fmt.Println("TODO: implement ActionSetExpireLimit.") + if this.User.Admin == 0 { + return errors.New("You are not an admin") + } value, err := strconv.ParseInt(cmd.Args[0], 10, 64) if err != nil { return err -- GitLab