Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion permission.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package gorbac

import (
"fmt"
"regexp"
)

// Permission interface
// T is the type of permission ID
type Permission[T comparable] interface {
Expand All @@ -26,5 +31,7 @@ func (p StdPermission[T]) ID() T {

// Match another permission
func (p StdPermission[T]) Match(a Permission[T]) bool {
return p.SID == a.ID()
match, _ := regexp.Match(fmt.Sprintf("%v", p.SID), []byte(fmt.Sprintf("%v", a.ID())))

return match
}