Documentation ¶
Index ¶
- Constants
- Variables
- func BcryptCheckStringHash(newString, hash string) bool
- func CheckErr(err error, message ...interface{})
- func InitJwtMiddleware(secret []byte, issuer string)
- func StartsWith(bigStr string, smallString string) bool
- type AuthMiddleware
- func (a *AuthMiddleware) AuthCheckMiddleware(c *gin.Context)
- func (a *AuthMiddleware) AuthCheckMiddlewareWithHttp(req *http.Request, writer http.ResponseWriter, doBasicAuthCheck bool) (okToContinue, abortRequest bool, returnRequest *http.Request)
- func (a *AuthMiddleware) BasicAuthCheckMiddlewareWithHttp(req *http.Request, writer http.ResponseWriter) (token *jwt.Token, err error)
- func (a *AuthMiddleware) SetUserCrud(curd ResourceAdapter)
- func (a *AuthMiddleware) SetUserGroupCrud(curd ResourceAdapter)
- func (a *AuthMiddleware) SetUserUserGroupCrud(curd ResourceAdapter)
- type AuthPermission
- type CmsUser
- type GroupPermission
- type ObjectPermission
- func (op ObjectPermission) GroupCan(a AuthPermission) bool
- func (op ObjectPermission) GuestCan(a AuthPermission) bool
- func (al ObjectPermission) IntValue() int64
- func (op ObjectPermission) OwnerCan(a AuthPermission) bool
- func (op *ObjectPermission) Scan(value interface{}) error
- func (al ObjectPermission) String() string
- func (op ObjectPermission) Value() (driver.Value, error)
- type ResourceAdapter
- type SessionUser
Constants ¶
View Source
const ( Read = ReadStrict | Peek Refer = ReferStrict | Read Create = CreateStrict | Read Update = UpdateStrict | Read Delete = DeleteStrict | Read Execute = ExecuteStrict | Peek CRUD = Read | Create | Update | Delete | Refer )
Variables ¶
View Source
var ALLOW_ALL_PERMISSIONS = NewPermission(CRUD|Execute, CRUD|Execute, CRUD|Execute)
View Source
var DEFAULT_PERMISSION = NewPermission(Peek|Refer, CRUD|Execute, CRUD|Execute)
Functions ¶
func BcryptCheckStringHash ¶ added in v0.6.5
func InitJwtMiddleware ¶
func StartsWith ¶
Types ¶
type AuthMiddleware ¶ added in v0.6.5
type AuthMiddleware struct {
// contains filtered or unexported fields
}
func NewAuthMiddleware ¶
func NewAuthMiddleware(db database.DatabaseConnection, userCrud ResourceAdapter, userGroupCrud ResourceAdapter, userUserGroupCrud ResourceAdapter) *AuthMiddleware
func NewAuthMiddlewareBuilder ¶
func NewAuthMiddlewareBuilder(db database.DatabaseConnection, issuer string) *AuthMiddleware
func (*AuthMiddleware) AuthCheckMiddleware ¶ added in v0.6.5
func (a *AuthMiddleware) AuthCheckMiddleware(c *gin.Context)
func (*AuthMiddleware) AuthCheckMiddlewareWithHttp ¶ added in v0.6.5
func (a *AuthMiddleware) AuthCheckMiddlewareWithHttp(req *http.Request, writer http.ResponseWriter, doBasicAuthCheck bool) (okToContinue, abortRequest bool, returnRequest *http.Request)
func (*AuthMiddleware) BasicAuthCheckMiddlewareWithHttp ¶ added in v0.6.5
func (a *AuthMiddleware) BasicAuthCheckMiddlewareWithHttp(req *http.Request, writer http.ResponseWriter) (token *jwt.Token, err error)
func (*AuthMiddleware) SetUserCrud ¶ added in v0.6.5
func (a *AuthMiddleware) SetUserCrud(curd ResourceAdapter)
func (*AuthMiddleware) SetUserGroupCrud ¶ added in v0.6.5
func (a *AuthMiddleware) SetUserGroupCrud(curd ResourceAdapter)
func (*AuthMiddleware) SetUserUserGroupCrud ¶ added in v0.6.5
func (a *AuthMiddleware) SetUserUserGroupCrud(curd ResourceAdapter)
type AuthPermission ¶ added in v0.5.7
type AuthPermission int64
const ( Peek AuthPermission = 1 << iota ReadStrict CreateStrict UpdateStrict DeleteStrict ExecuteStrict ReferStrict )
const None AuthPermission = iota
func (AuthPermission) String ¶ added in v0.5.7
func (a AuthPermission) String() string
type GroupPermission ¶
type GroupPermission struct { GroupReferenceId string `db:"GroupReferenceId"` ObjectReferenceId string `db:"ObjectReferenceId"` RelationReferenceId string `db:"RelationReferenceId"` Permission ObjectPermission }
type ObjectPermission ¶ added in v0.5.7
type ObjectPermission struct { OwnerPermission AuthPermission GroupPermission AuthPermission GuestPermission AuthPermission }
func NewPermission ¶ added in v0.5.7
func NewPermission(guest AuthPermission, group AuthPermission, owner AuthPermission) ObjectPermission
func ParsePermission ¶ added in v0.5.7
func ParsePermission(p int64) ObjectPermission
func (ObjectPermission) GroupCan ¶ added in v0.5.7
func (op ObjectPermission) GroupCan(a AuthPermission) bool
func (ObjectPermission) GuestCan ¶ added in v0.5.7
func (op ObjectPermission) GuestCan(a AuthPermission) bool
func (ObjectPermission) IntValue ¶ added in v0.5.7
func (al ObjectPermission) IntValue() int64
func (ObjectPermission) OwnerCan ¶ added in v0.5.7
func (op ObjectPermission) OwnerCan(a AuthPermission) bool
func (*ObjectPermission) Scan ¶ added in v0.5.7
func (op *ObjectPermission) Scan(value interface{}) error
func (ObjectPermission) String ¶ added in v0.5.7
func (al ObjectPermission) String() string
type ResourceAdapter ¶ added in v0.6.5
type SessionUser ¶ added in v0.4.0
type SessionUser struct { UserId int64 UserReferenceId string Groups []GroupPermission }
Click to show internal directories.
Click to hide internal directories.