Skip to content

Commit

Permalink
Use admin client for user mods
Browse files Browse the repository at this point in the history
  • Loading branch information
aebruno committed Jan 27, 2023
1 parent b7d3353 commit 58f0099
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/sshpubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package server
import (
"github.com/gofiber/fiber/v2"
log "github.com/sirupsen/logrus"
"github.com/ubccr/goipa"
ipa "github.com/ubccr/goipa"
)

func (r *Router) SSHKeyList(c *fiber.Ctx) error {
Expand All @@ -21,7 +21,6 @@ func (r *Router) SSHKeyModal(c *fiber.Ctx) error {

func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {
user := r.user(c)
client := r.userClient(c)

title := c.FormValue("title")
key := c.FormValue("key")
Expand All @@ -46,7 +45,7 @@ func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {

user.AddSSHAuthorizedKey(authKey)

user, err = client.UserMod(user)
user, err = r.adminClient.UserMod(user)
if err != nil {
return err
}
Expand All @@ -66,13 +65,12 @@ func (r *Router) SSHKeyAdd(c *fiber.Ctx) error {

func (r *Router) SSHKeyRemove(c *fiber.Ctx) error {
fp := c.FormValue("fp")
client := r.userClient(c)
user := r.user(c)

user.RemoveSSHAuthorizedKey(fp)

var err error
user, err = client.UserMod(user)
user, err = r.adminClient.UserMod(user)
if err != nil {
return err
}
Expand Down

0 comments on commit 58f0099

Please sign in to comment.