func (perm *Permissions) Rejected(w http.ResponseWriter, req *http.Request) bool {
	path := req.URL.Path  
	if perm.rootIsPublic && path == "/" {
		return false
	}
	for _, prefix := range perm.adminPathPrefixes {
		if strings.HasPrefix(path, prefix) {
			if !perm.state.AdminRights(req) {
				return true
			}
		}
	}
	for _, prefix := range perm.userPathPrefixes {
		if strings.HasPrefix(path, prefix) {
			if !perm.state.UserRights(req) {
				return true
			}
		}
	}
	found := false
	for _, prefix := range perm.publicPathPrefixes {
		if strings.HasPrefix(path, prefix) {
			found = true
			break
		}
	}
	return !found
}
Rejected will check if a given request should be rejected.
package pstore
import (
	"net/http"
	"strings"
	"github.com/xyproto/pinterface"
)
type Permissions struct {
	state              *UserState
	adminPathPrefixes  []string
	userPathPrefixes   []string
	publicPathPrefixes []string
	rootIsPublic       bool
	denied             http.HandlerFunc
}
const (
	Version = 3.0
)
func New() (*Permissions, error) {
	state, err := NewUserStateSimple()
	if err != nil {
		return nil, err
	}
	return NewPermissions(state), nil
}
func NewWithConf(connectionString string) (*Permissions, error) {
	state, err := NewUserState(connectionString, true)
	if err != nil {
		return nil, err
	}
	return NewPermissions(state), nil
}
func NewWithDSN(connectionString string, databaseName string) (*Permissions, error) {
	state, err := NewUserStateWithDSN(connectionString, databaseName, true)
	if err != nil {
		return nil, err
	}
	return NewPermissions(state), nil
}
func NewPermissions(state *UserState) *Permissions {
	return &Permissions{state,
		[]string{"/admin"},          
		[]string{"/repo", "/data"},  
		[]string{"/", "/login", "/register", "/favicon.ico", "/style", "/img", "/js",
			"/favicon.ico", "/robots.txt", "/sitemap_index.xml"},  
		true,
		PermissionDenied}
}
func (perm *Permissions) SetDenyFunction(f http.HandlerFunc) {
	perm.denied = f
}
func (perm *Permissions) DenyFunction() http.HandlerFunc {
	return perm.denied
}
func (perm *Permissions) UserState() pinterface.IUserState {
	return perm.state
}
func (perm *Permissions) Clear() {
	perm.adminPathPrefixes = []string{}
	perm.userPathPrefixes = []string{}
}
func (perm *Permissions) AddAdminPath(prefix string) {
	perm.adminPathPrefixes = append(perm.adminPathPrefixes, prefix)
}
func (perm *Permissions) AddUserPath(prefix string) {
	perm.userPathPrefixes = append(perm.userPathPrefixes, prefix)
}
func (perm *Permissions) AddPublicPath(prefix string) {
	perm.publicPathPrefixes = append(perm.publicPathPrefixes, prefix)
}
func (perm *Permissions) SetAdminPath(pathPrefixes []string) {
	perm.adminPathPrefixes = pathPrefixes
}
func (perm *Permissions) SetUserPath(pathPrefixes []string) {
	perm.userPathPrefixes = pathPrefixes
}
func (perm *Permissions) SetPublicPath(pathPrefixes []string) {
	perm.publicPathPrefixes = pathPrefixes
}
func PermissionDenied(w http.ResponseWriter, req *http.Request) {
	http.Error(w, "Permission denied.", http.StatusForbidden)
}