Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 27, 2024
1 parent 763d65f commit 0577c47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions routes/teams/endpoints/edit_team_member/route.go
Expand Up @@ -106,7 +106,7 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {

defer tx.Rollback(d.Context)

if len(payload.Perms) != 0 {
if payload.Perms != nil {
if !kittycat.HasPerm(managerPerms, kittycat.Build("team_member", teams.PermissionEdit)) {
return uapi.HttpResponse{
Status: http.StatusForbidden,
Expand All @@ -126,7 +126,7 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {
}

// Perform initial checks
for _, perm := range payload.Perms {
for _, perm := range *payload.Perms {
if !teams.IsValidPerm(perm) {
return uapi.HttpResponse{
Status: http.StatusBadRequest,
Expand All @@ -140,7 +140,7 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {
// Right now, we use perm overrides for this
// as we do not have a hierarchy system yet
newPermsResolved := kittycat.StaffPermissions{
PermOverrides: payload.Perms,
PermOverrides: *payload.Perms,
}.Resolve()

// First ensure that the manager can set these permissions
Expand Down
6 changes: 3 additions & 3 deletions types/teams.go
Expand Up @@ -88,9 +88,9 @@ type AddTeamMember struct {
}

type EditTeamMember struct {
Perms []string `json:"perms" description:"The permissions to set. If empty, will not update"`
Mentionable *bool `json:"mentionable" description:"Whether the user is mentionable Whether the user is mentionable (for alerts in bot-logs etc.)"`
DataHolder *bool `db:"data_holder" json:"data_holder" description:"Whether the user is a data holder responsible for all data on the team. That is, should performing mass-scale operations on them affect the team"`
Perms *[]string `json:"perms" description:"The permissions to set. If empty, will not update"`
Mentionable *bool `json:"mentionable" description:"Whether the user is mentionable Whether the user is mentionable (for alerts in bot-logs etc.)"`
DataHolder *bool `db:"data_holder" json:"data_holder" description:"Whether the user is a data holder responsible for all data on the team. That is, should performing mass-scale operations on them affect the team"`
}

type UserEntityPerms struct {
Expand Down

0 comments on commit 0577c47

Please sign in to comment.