Documentation ¶
Index ¶
- type API
- func (api *API) DeletePolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) GetPermissionsBundleHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) GetPolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) GetRoleHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) GetRolesHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) PostPolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) UpdatePolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- type PermissionsBundler
- type PermissionsStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API provides a struct to wrap the api around
func Setup ¶
func Setup( cfg *config.Config, r *mux.Router, permissionsStore PermissionsStore, bundler PermissionsBundler, auth authorisation.Middleware) *API
Setup function sets up the api and returns an api
func (*API) DeletePolicyHandler ¶ added in v0.8.0
func (api *API) DeletePolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
DeletePolicyHandler is a handler that deletes policy by its ID from DB
func (*API) GetPermissionsBundleHandler ¶ added in v0.5.0
func (api *API) GetPermissionsBundleHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
GetPermissionsBundleHandler gets and returns the permissions bundle as JSON in the HTTP response body.
func (*API) GetPolicyHandler ¶ added in v0.5.0
func (api *API) GetPolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
GetPolicyHandler is a handler that gets policy by its ID from DB
func (*API) GetRoleHandler ¶ added in v0.3.0
func (api *API) GetRoleHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
GetRoleHandler is a handler that gets a role by its ID from MongoDB
func (*API) GetRolesHandler ¶ added in v0.4.0
func (api *API) GetRolesHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
GetRolesHandler is a handler that gets all roles from MongoDB
func (*API) PostPolicyHandler ¶ added in v0.5.0
func (api *API) PostPolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
PostPolicyHandler is a handler that creates a new policies in DB
func (*API) UpdatePolicyHandler ¶ added in v0.8.0
func (api *API) UpdatePolicyHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
UpdatePolicyHandler is a handler that updates policy by its ID from DB
type PermissionsBundler ¶ added in v0.5.0
PermissionsBundler defines the functions used by the API to get permissions bundles
type PermissionsStore ¶ added in v0.3.0
type PermissionsStore interface { Checker(ctx context.Context, state *healthcheck.CheckState) error Close(ctx context.Context) error GetRole(ctx context.Context, id string) (*models.Role, error) GetRoles(ctx context.Context, offset, limit int) (*models.Roles, error) AddPolicy(ctx context.Context, policy *models.Policy) (*models.Policy, error) UpdatePolicy(ctx context.Context, policy *models.Policy) (*models.UpdateResult, error) GetPolicy(ctx context.Context, id string) (*models.Policy, error) DeletePolicy(ctx context.Context, id string) error }
PermissionsStore defines the behaviour of a PermissionsStore