Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fixing issue that Thomas pointed out
  • Loading branch information
bapril committed Mar 7, 2018
1 parent c4dcbef commit 9fd07cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/ctx.go
Expand Up @@ -944,7 +944,7 @@ func (ctx *PfCtxS) IsSysAdmin() bool {
// perm1,perm2,perm3
//
// When an unknown permission is encountered, this function will return an error.
func (perm Perm) FromString(str string) (err error) {
func FromString(str string) (perm Perm,err error) {
str = strings.ToLower(str)

perm = PERM_NOTHING
Expand Down Expand Up @@ -1332,7 +1332,7 @@ func (ctx *PfCtxS) CheckPerms(what string, perms Perm) (ok bool, err error) {
func (ctx *PfCtxS) CheckPermsT(what string, permstr string) (ok bool, err error) {
var perms Perm

err = perms.FromString(permstr)
perms,err = FromString(permstr)
if err != nil {
return
}
Expand Down
3 changes: 2 additions & 1 deletion lib/struct.go
Expand Up @@ -1353,6 +1353,7 @@ func StructDetailsA(ctx PfCtx, obj interface{}, field string, opts StructDetails
if checkperms {
ok := true
permstr := f.Tag.Get("pfset")

ok, err = ctx.CheckPermsT("StructDetails("+fname+")", permstr)
if !ok {
return "", "", "", err
Expand Down Expand Up @@ -1533,7 +1534,7 @@ func StructMenuA(ctx PfCtx, subjects []string, objtrail []interface{}, obj inter
}

set := f.Tag.Get(tag)
err = perms.FromString(set)
perms,err = FromString(set)
if err != nil {
return
}
Expand Down

0 comments on commit 9fd07cb

Please sign in to comment.