Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnStutzenstein committed Feb 4, 2021
1 parent 625ceea commit 3380911
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions internal/apps/chat/restrict.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
"github.com/OpenSlides/openslides3-autoupdate-service/internal/restricter"
)

// CanManage is the manage permission for chat objects.
const CanManage = "chat.can_manage"

type required interface {
restricter.HasPermer
InGroups(uid int, groups []int) bool
Expand All @@ -18,8 +15,7 @@ type required interface {
// Restrict restricts chat/chat-group and chat/chat-message.
func Restrict(r required) restricter.ElementFunc {
return func(uid int, data json.RawMessage) (json.RawMessage, error) {
if r.HasPerm(uid, CanManage) {
fmt.Printf("User %d can manage\n", uid)
if r.HasPerm(uid, "chat.can_manage") {
return data, nil
}

Expand All @@ -31,11 +27,9 @@ func Restrict(r required) restricter.ElementFunc {
}

if r.InGroups(uid, chatobject.AccessGroupsId) {
fmt.Printf("User %d is in group\n", uid)
return data, nil
}

fmt.Printf("User %d is not in group\n", uid)
return nil, nil
}
}

0 comments on commit 3380911

Please sign in to comment.