mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-25 17:53:56 +01:00
documentation (authorisation): example of authorisation plugin
This commit is contained in:
parent
ebb4247a77
commit
f2ba98bf4a
1 changed files with 46 additions and 0 deletions
46
server/plugin/plg_authorisation_example/index.go
Normal file
46
server/plugin/plg_authorisation_example/index.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package plg_authorisation_example
|
||||
|
||||
import (
|
||||
. "github.com/mickael-kerjean/filestash/server/common"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Hooks.Register.AuthorisationMiddleware(AuthM{})
|
||||
}
|
||||
|
||||
type AuthM struct{}
|
||||
|
||||
func (this AuthM) Ls(ctx App, path string) error {
|
||||
Log.Stdout("LS %+v", ctx.Session)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this AuthM) Cat(ctx App, path string) error {
|
||||
Log.Stdout("CAT %+v", ctx.Session)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this AuthM) Mkdir(ctx App, path string) error {
|
||||
Log.Stdout("MKDIR %+v", ctx.Session)
|
||||
return ErrNotAllowed
|
||||
}
|
||||
|
||||
func (this AuthM) Rm(ctx App, path string) error {
|
||||
Log.Stdout("RM %+v", ctx.Session)
|
||||
return ErrNotAllowed
|
||||
}
|
||||
|
||||
func (this AuthM) Mv(ctx App, from string, to string) error {
|
||||
Log.Stdout("MV %+v", ctx.Session)
|
||||
return ErrNotAllowed
|
||||
}
|
||||
|
||||
func (this AuthM) Save(ctx App, path string) error {
|
||||
Log.Stdout("SAVE %+v", ctx.Session)
|
||||
return ErrNotAllowed
|
||||
}
|
||||
|
||||
func (this AuthM) Touch(ctx App, path string) error {
|
||||
Log.Stdout("TOUCH %+v", ctx.Session)
|
||||
return ErrNotAllowed
|
||||
}
|
||||
Loading…
Reference in a new issue