Documentation ¶
Index ¶
- type AdminResource
- type AfterCreateHook
- type AfterDeleteHook
- type AfterUpdateHook
- type AllowCreateHook
- type AllowDeleteHook
- type AllowFindHook
- type AllowUpdateHook
- type ApiAfterFindHook
- type ApiAlterQueryHook
- type ApiCreateHook
- type ApiDeleteHook
- type ApiFindHook
- type ApiFindOneHook
- type ApiHttpRoutes
- type ApiUpdateHook
- type BeforeCreateHook
- type BeforeDeleteHook
- type BeforeUpdateHook
- type CreateHook
- type DeleteHook
- type LoggedInResource
- type MethodsHook
- type PublicWriteResource
- type ReadOnlyResource
- type Resource
- func (res *Resource) ApiCreate(obj kit.Model, r kit.Request) kit.Response
- func (res *Resource) ApiDelete(id string, r kit.Request) kit.Response
- func (res *Resource) ApiFind(query *db.Query, r kit.Request) kit.Response
- func (res *Resource) ApiFindOne(rawId string, r kit.Request) kit.Response
- func (res *Resource) ApiPartialUpdate(obj kit.Model, r kit.Request) kit.Response
- func (res *Resource) ApiUpdate(obj kit.Model, r kit.Request) kit.Response
- func (res *Resource) Backend() db.Backend
- func (res *Resource) Collection() string
- func (res Resource) Count(q *db.Query) (int, apperror.Error)
- func (res *Resource) Create(obj kit.Model, user kit.User) apperror.Error
- func (res *Resource) CreateModel() kit.Model
- func (res *Resource) Debug() bool
- func (res *Resource) Delete(obj kit.Model, user kit.User) apperror.Error
- func (res *Resource) FindOne(rawId interface{}) (kit.Model, apperror.Error)
- func (res *Resource) Hooks() interface{}
- func (res *Resource) IsPublic() bool
- func (res *Resource) Model() kit.Model
- func (res *Resource) ModelInfo() *db.ModelInfo
- func (res *Resource) PartialUpdate(obj kit.Model, user kit.User) apperror.Error
- func (res Resource) Q() *db.Query
- func (res Resource) Query(q *db.Query, targetSlice ...interface{}) ([]kit.Model, apperror.Error)
- func (res *Resource) Registry() kit.Registry
- func (res *Resource) SetBackend(b db.Backend)
- func (res *Resource) SetDebug(x bool)
- func (res *Resource) SetHooks(h interface{})
- func (res *Resource) SetModel(x kit.Model)
- func (res *Resource) SetRegistry(x kit.Registry)
- func (res *Resource) Update(obj kit.Model, user kit.User) apperror.Error
- type Service
- func (s *Service) Create(m kit.Model, user kit.User) apperror.Error
- func (s *Service) Debug() bool
- func (s *Service) Delete(m kit.Model, user kit.User) apperror.Error
- func (s *Service) FindOne(modelType string, id string) (kit.Model, apperror.Error)
- func (s *Service) Q(modelType string) (*db.Query, apperror.Error)
- func (s *Service) RegisterResource(res kit.Resource)
- func (s *Service) Registry() kit.Registry
- func (s *Service) Resource(name string) kit.Resource
- func (s *Service) SetDebug(x bool)
- func (s *Service) SetDefaultBackend(b db.Backend)
- func (s *Service) SetRegistry(x kit.Registry)
- func (s *Service) Update(m kit.Model, user kit.User) apperror.Error
- type UpdateHook
- type UserResource
- func (UserResource) AllowCreate(res kit.Resource, obj kit.Model, user kit.User) bool
- func (UserResource) AllowDelete(res kit.Resource, obj kit.Model, user kit.User) bool
- func (UserResource) AllowFind(res kit.Resource, model kit.Model, user kit.User) bool
- func (UserResource) AllowUpdate(res kit.Resource, obj kit.Model, old kit.Model, user kit.User) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminResource ¶
type AdminResource struct{}
AdminResource is a mixin that restricts create, update and delete. Only users with the role admin or with the permission action_collectionname may create, update or delete objects. So if you want to allow a role to update all items in a collection "totos", the permission update_todos to the role.
func (AdminResource) AllowCreate ¶
func (AdminResource) AllowDelete ¶
type AfterCreateHook ¶
type AfterDeleteHook ¶
type AfterUpdateHook ¶
type AllowCreateHook ¶
type AllowDeleteHook ¶
type AllowFindHook ¶
type AllowUpdateHook ¶
type ApiAfterFindHook ¶
type ApiAlterQueryHook ¶
type ApiCreateHook ¶
type ApiDeleteHook ¶
type ApiFindHook ¶
type ApiFindOneHook ¶
type ApiHttpRoutes ¶
type ApiHttpRoutes interface { // Allows to set up custom http handlers with the httprouter directly. HttpRoutes(kit.Resource) []kit.HttpRoute }
ApiHttpRoutes allows a reseource to specify custom http routes.
type ApiUpdateHook ¶
type BeforeCreateHook ¶
type BeforeDeleteHook ¶
type BeforeUpdateHook ¶
type CreateHook ¶
type DeleteHook ¶
type LoggedInResource ¶
type LoggedInResource struct{}
LoggedInResource is a resource mixin that restricts create, read and update operations to logged in users.
func (LoggedInResource) AllowCreate ¶
func (LoggedInResource) AllowDelete ¶
type MethodsHook ¶
MethodsHook allows a resource to specify additional methods.
type PublicWriteResource ¶
type PublicWriteResource struct{}
PublicWriteResource is a resource mixin that allows create/update/delete to all API users, event without an account.
func (PublicWriteResource) AllowCreate ¶
func (PublicWriteResource) AllowDelete ¶
type ReadOnlyResource ¶
type ReadOnlyResource struct{}
ReadOnlyResource is a resource mixin that prevents all create/update/delete actions via the API.
func (ReadOnlyResource) AllowCreate ¶
func (ReadOnlyResource) AllowDelete ¶
func (ReadOnlyResource) AllowUpdate ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) ApiFindOne ¶
func (*Resource) ApiPartialUpdate ¶
func (*Resource) Collection ¶
func (*Resource) CreateModel ¶
func (*Resource) PartialUpdate ¶
func (*Resource) SetBackend ¶
func (*Resource) SetRegistry ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) RegisterResource ¶
func (*Service) SetDefaultBackend ¶
func (*Service) SetRegistry ¶
type UpdateHook ¶
type UserResource ¶
type UserResource struct{}
UserResource is a resource mixin that restricts create, read and update operations to admins, users with the permission action_collectionname (see AdminResource) or users that own the model. This can only be used for models that implement the appkit.UserModel interface.