Documentation ¶
Index ¶
- Constants
- type PostgresDataAccess
- func (da PostgresDataAccess) BundleCreate(ctx context.Context, bundle data.Bundle) error
- func (da PostgresDataAccess) BundleDelete(ctx context.Context, name, version string) error
- func (da PostgresDataAccess) BundleDisable(ctx context.Context, name, version string) error
- func (da PostgresDataAccess) BundleEnable(ctx context.Context, name, version string) error
- func (da PostgresDataAccess) BundleEnabledVersion(ctx context.Context, bundlename string) (string, error)
- func (da PostgresDataAccess) BundleExists(ctx context.Context, name, version string) (bool, error)
- func (da PostgresDataAccess) BundleGet(ctx context.Context, name, version string) (data.Bundle, error)
- func (da PostgresDataAccess) BundleList(ctx context.Context) ([]data.Bundle, error)
- func (da PostgresDataAccess) BundleUpdate(ctx context.Context, bundle data.Bundle) error
- func (da PostgresDataAccess) BundleVersionList(ctx context.Context, name string) ([]data.Bundle, error)
- func (da PostgresDataAccess) FindCommandEntry(ctx context.Context, bundleName, commandName string) ([]data.CommandEntry, error)
- func (da PostgresDataAccess) GroupCreate(ctx context.Context, group rest.Group) error
- func (da PostgresDataAccess) GroupDelete(ctx context.Context, groupname string) error
- func (da PostgresDataAccess) GroupExists(ctx context.Context, groupname string) (bool, error)
- func (da PostgresDataAccess) GroupGet(ctx context.Context, groupname string) (rest.Group, error)
- func (da PostgresDataAccess) GroupList(ctx context.Context) ([]rest.Group, error)
- func (da PostgresDataAccess) GroupPermissionList(ctx context.Context, groupname string) (rest.RolePermissionList, error)
- func (da PostgresDataAccess) GroupRoleAdd(ctx context.Context, groupname, rolename string) error
- func (da PostgresDataAccess) GroupRoleDelete(ctx context.Context, groupname, rolename string) error
- func (da PostgresDataAccess) GroupRoleList(ctx context.Context, groupname string) ([]rest.Role, error)
- func (da PostgresDataAccess) GroupUpdate(ctx context.Context, group rest.Group) error
- func (da PostgresDataAccess) GroupUserAdd(ctx context.Context, groupname string, username string) error
- func (da PostgresDataAccess) GroupUserDelete(ctx context.Context, groupname string, username string) error
- func (da PostgresDataAccess) GroupUserList(ctx context.Context, groupname string) ([]rest.User, error)
- func (da PostgresDataAccess) Initialize(ctx context.Context) error
- func (da PostgresDataAccess) RequestBegin(ctx context.Context, req *data.CommandRequest) error
- func (da PostgresDataAccess) RequestClose(ctx context.Context, res data.CommandResponse) error
- func (da PostgresDataAccess) RequestError(ctx context.Context, req data.CommandRequest, err error) error
- func (da PostgresDataAccess) RequestUpdate(ctx context.Context, req data.CommandRequest) error
- func (da PostgresDataAccess) RoleCreate(ctx context.Context, name string) error
- func (da PostgresDataAccess) RoleDelete(ctx context.Context, name string) error
- func (da PostgresDataAccess) RoleExists(ctx context.Context, rolename string) (bool, error)
- func (da PostgresDataAccess) RoleGet(ctx context.Context, name string) (rest.Role, error)
- func (da PostgresDataAccess) RoleGroupAdd(ctx context.Context, rolename, groupname string) error
- func (da PostgresDataAccess) RoleGroupDelete(ctx context.Context, rolename, groupname string) error
- func (da PostgresDataAccess) RoleGroupExists(ctx context.Context, rolename, groupname string) (bool, error)
- func (da PostgresDataAccess) RoleGroupList(ctx context.Context, rolename string) ([]rest.Group, error)
- func (da PostgresDataAccess) RoleList(ctx context.Context) ([]rest.Role, error)
- func (da PostgresDataAccess) RolePermissionAdd(ctx context.Context, rolename, bundle, permission string) error
- func (da PostgresDataAccess) RolePermissionDelete(ctx context.Context, rolename, bundle, permission string) error
- func (da PostgresDataAccess) RolePermissionExists(ctx context.Context, rolename, bundlename, permission string) (bool, error)
- func (da PostgresDataAccess) RolePermissionList(ctx context.Context, rolename string) (rest.RolePermissionList, error)
- func (da PostgresDataAccess) TokenEvaluate(ctx context.Context, tokenString string) bool
- func (da PostgresDataAccess) TokenGenerate(ctx context.Context, username string, duration time.Duration) (rest.Token, error)
- func (da PostgresDataAccess) TokenInvalidate(ctx context.Context, tokenString string) error
- func (da PostgresDataAccess) TokenRetrieveByToken(ctx context.Context, tokenString string) (rest.Token, error)
- func (da PostgresDataAccess) TokenRetrieveByUser(ctx context.Context, username string) (rest.Token, error)
- func (da PostgresDataAccess) UserAuthenticate(ctx context.Context, username string, password string) (bool, error)
- func (da PostgresDataAccess) UserCreate(ctx context.Context, user rest.User) error
- func (da PostgresDataAccess) UserDelete(ctx context.Context, username string) error
- func (da PostgresDataAccess) UserExists(ctx context.Context, username string) (bool, error)
- func (da PostgresDataAccess) UserGet(ctx context.Context, username string) (rest.User, error)
- func (da PostgresDataAccess) UserGetByEmail(ctx context.Context, email string) (rest.User, error)
- func (da PostgresDataAccess) UserGetByID(ctx context.Context, adapter, id string) (rest.User, error)
- func (da PostgresDataAccess) UserGroupAdd(ctx context.Context, username string, groupname string) error
- func (da PostgresDataAccess) UserGroupDelete(ctx context.Context, username string, groupname string) error
- func (da PostgresDataAccess) UserGroupList(ctx context.Context, username string) ([]rest.Group, error)
- func (da PostgresDataAccess) UserList(ctx context.Context) ([]rest.User, error)
- func (da PostgresDataAccess) UserPermissionList(ctx context.Context, username string) (rest.RolePermissionList, error)
- func (da PostgresDataAccess) UserRoleList(ctx context.Context, username string) ([]rest.Role, error)
- func (da PostgresDataAccess) UserUpdate(ctx context.Context, user rest.User) error
Constants ¶
const (
DatabaseGort = "gort"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDataAccess ¶
type PostgresDataAccess struct {
// contains filtered or unexported fields
}
PostgresDataAccess is a data access implementation backed by a database.
func NewPostgresDataAccess ¶
func NewPostgresDataAccess(configs data.DatabaseConfigs) PostgresDataAccess
NewPostgresDataAccess returns a new PostgresDataAccess based on the supplied config.
func (PostgresDataAccess) BundleCreate ¶
BundleCreate TBD
func (PostgresDataAccess) BundleDelete ¶
func (da PostgresDataAccess) BundleDelete(ctx context.Context, name, version string) error
BundleDelete TBD
func (PostgresDataAccess) BundleDisable ¶
func (da PostgresDataAccess) BundleDisable(ctx context.Context, name, version string) error
BundleDisable TBD
func (PostgresDataAccess) BundleEnable ¶
func (da PostgresDataAccess) BundleEnable(ctx context.Context, name, version string) error
BundleEnable TBD
func (PostgresDataAccess) BundleEnabledVersion ¶
func (da PostgresDataAccess) BundleEnabledVersion(ctx context.Context, bundlename string) (string, error)
BundleEnabledVersion returns the currently enabled version of the specified bundle. If no version is enabled an empty string will be returned.
func (PostgresDataAccess) BundleExists ¶
BundleExists TBD
func (PostgresDataAccess) BundleGet ¶
func (da PostgresDataAccess) BundleGet(ctx context.Context, name, version string) (data.Bundle, error)
BundleGet TBD
func (PostgresDataAccess) BundleList ¶
BundleList TBD
func (PostgresDataAccess) BundleUpdate ¶
BundleUpdate TBD
func (PostgresDataAccess) BundleVersionList ¶
func (da PostgresDataAccess) BundleVersionList(ctx context.Context, name string) ([]data.Bundle, error)
BundleVersionList TBD
func (PostgresDataAccess) FindCommandEntry ¶
func (da PostgresDataAccess) FindCommandEntry(ctx context.Context, bundleName, commandName string) ([]data.CommandEntry, error)
FindCommandEntry is used to find the enabled commands with the provided bundle and command names. If either is empty, it is treated as a wildcard. Importantly, this must only return ENABLED commands!
func (PostgresDataAccess) GroupCreate ¶
GroupCreate creates a new user group.
func (PostgresDataAccess) GroupDelete ¶
func (da PostgresDataAccess) GroupDelete(ctx context.Context, groupname string) error
GroupDelete deletes a group.
func (PostgresDataAccess) GroupExists ¶
GroupExists is used to determine whether a group exists in the data store.
func (PostgresDataAccess) GroupList ¶
GroupList returns a list of all known groups in the datastore. Passwords are not included. Nice try.
func (PostgresDataAccess) GroupPermissionList ¶
func (da PostgresDataAccess) GroupPermissionList(ctx context.Context, groupname string) (rest.RolePermissionList, error)
func (PostgresDataAccess) GroupRoleAdd ¶
func (da PostgresDataAccess) GroupRoleAdd(ctx context.Context, groupname, rolename string) error
GroupRoleAdd grants one or more roles to a group.
func (PostgresDataAccess) GroupRoleDelete ¶
func (da PostgresDataAccess) GroupRoleDelete(ctx context.Context, groupname, rolename string) error
GroupRoleDelete revokes a role from a group.
func (PostgresDataAccess) GroupRoleList ¶
func (PostgresDataAccess) GroupUpdate ¶
GroupUpdate is used to update an existing group. An error is returned if the groupname is empty or if the group doesn't exist. TODO Should we let this create groups that don't exist?
func (PostgresDataAccess) GroupUserAdd ¶
func (da PostgresDataAccess) GroupUserAdd(ctx context.Context, groupname string, username string) error
GroupUserAdd adds a user to a group
func (PostgresDataAccess) GroupUserDelete ¶
func (da PostgresDataAccess) GroupUserDelete(ctx context.Context, groupname string, username string) error
GroupUserDelete removes a user from a group.
func (PostgresDataAccess) GroupUserList ¶
func (da PostgresDataAccess) GroupUserList(ctx context.Context, groupname string) ([]rest.User, error)
GroupUserList returns a list of all known users in a group.
func (PostgresDataAccess) Initialize ¶
func (da PostgresDataAccess) Initialize(ctx context.Context) error
Initialize sets up the database.
func (PostgresDataAccess) RequestBegin ¶
func (da PostgresDataAccess) RequestBegin(ctx context.Context, req *data.CommandRequest) error
func (PostgresDataAccess) RequestClose ¶
func (da PostgresDataAccess) RequestClose(ctx context.Context, res data.CommandResponse) error
func (PostgresDataAccess) RequestError ¶
func (da PostgresDataAccess) RequestError(ctx context.Context, req data.CommandRequest, err error) error
func (PostgresDataAccess) RequestUpdate ¶
func (da PostgresDataAccess) RequestUpdate(ctx context.Context, req data.CommandRequest) error
func (PostgresDataAccess) RoleCreate ¶
func (da PostgresDataAccess) RoleCreate(ctx context.Context, name string) error
RoleCreate creates a new role.
func (PostgresDataAccess) RoleDelete ¶
func (da PostgresDataAccess) RoleDelete(ctx context.Context, name string) error
RoleDelete
func (PostgresDataAccess) RoleExists ¶
RoleExists is used to determine whether a group exists in the data store.
func (PostgresDataAccess) RoleGroupAdd ¶
func (da PostgresDataAccess) RoleGroupAdd(ctx context.Context, rolename, groupname string) error
func (PostgresDataAccess) RoleGroupDelete ¶
func (da PostgresDataAccess) RoleGroupDelete(ctx context.Context, rolename, groupname string) error
func (PostgresDataAccess) RoleGroupExists ¶
func (PostgresDataAccess) RoleGroupList ¶
func (PostgresDataAccess) RolePermissionAdd ¶
func (da PostgresDataAccess) RolePermissionAdd(ctx context.Context, rolename, bundle, permission string) error
func (PostgresDataAccess) RolePermissionDelete ¶
func (da PostgresDataAccess) RolePermissionDelete(ctx context.Context, rolename, bundle, permission string) error
func (PostgresDataAccess) RolePermissionExists ¶
func (da PostgresDataAccess) RolePermissionExists(ctx context.Context, rolename, bundlename, permission string) (bool, error)
RolePermissionExists returns true if the given role has been granted the specified permission. It returns an error if rolename is empty or if no such role exists.
func (PostgresDataAccess) RolePermissionList ¶
func (da PostgresDataAccess) RolePermissionList(ctx context.Context, rolename string) (rest.RolePermissionList, error)
RolePermissionList returns returns an alphabetically-sorted list of fully-qualified (i.e., "bundle:permission") permissions granted to the role.
func (PostgresDataAccess) TokenEvaluate ¶
func (da PostgresDataAccess) TokenEvaluate(ctx context.Context, tokenString string) bool
TokenEvaluate will test a token for validity. It returns true if the token exists and is still within its valid period; false otherwise.
func (PostgresDataAccess) TokenGenerate ¶
func (da PostgresDataAccess) TokenGenerate(ctx context.Context, username string, duration time.Duration) (rest.Token, error)
TokenGenerate generates a new token for the given user with a specified expiration duration. Any existing token for this user will be automatically invalidated. If the user doesn't exist an error is returned.
func (PostgresDataAccess) TokenInvalidate ¶
func (da PostgresDataAccess) TokenInvalidate(ctx context.Context, tokenString string) error
TokenInvalidate immediately invalidates the specified token. An error is returned if the token doesn't exist.
func (PostgresDataAccess) TokenRetrieveByToken ¶
func (da PostgresDataAccess) TokenRetrieveByToken(ctx context.Context, tokenString string) (rest.Token, error)
TokenRetrieveByToken retrieves the token by its value. An error is returned if no such token exists.
func (PostgresDataAccess) TokenRetrieveByUser ¶
func (da PostgresDataAccess) TokenRetrieveByUser(ctx context.Context, username string) (rest.Token, error)
TokenRetrieveByUser retrieves the token associated with a username. An error is returned if no such token (or user) exists.
func (PostgresDataAccess) UserAuthenticate ¶
func (da PostgresDataAccess) UserAuthenticate(ctx context.Context, username string, password string) (bool, error)
UserAuthenticate authenticates a username/password combination.
func (PostgresDataAccess) UserCreate ¶
UserCreate is used to create a new Gort user in the data store. An error is returned if the username is empty or if a user already exists.
func (PostgresDataAccess) UserDelete ¶
func (da PostgresDataAccess) UserDelete(ctx context.Context, username string) error
UserDelete deletes an existing user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.
func (PostgresDataAccess) UserExists ¶
UserExists is used to determine whether a Gort user with the given username exists in the data store.
func (PostgresDataAccess) UserGet ¶
UserGet returns a user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.
func (PostgresDataAccess) UserGetByEmail ¶
UserGetByEmail returns a user from the data store. An error is returned if the email parameter is empty or if the user doesn't exist.
func (PostgresDataAccess) UserGetByID ¶ added in v0.8.4
func (da PostgresDataAccess) UserGetByID(ctx context.Context, adapter, id string) (rest.User, error)
UserGetByID returns a user from the data store. An error is returned if eitherparameter is empty or if the user doesn't exist.
func (PostgresDataAccess) UserGroupAdd ¶
func (da PostgresDataAccess) UserGroupAdd(ctx context.Context, username string, groupname string) error
UserGroupAdd comments TBD
func (PostgresDataAccess) UserGroupDelete ¶
func (da PostgresDataAccess) UserGroupDelete(ctx context.Context, username string, groupname string) error
UserGroupDelete comments TBD
func (PostgresDataAccess) UserGroupList ¶
func (da PostgresDataAccess) UserGroupList(ctx context.Context, username string) ([]rest.Group, error)
UserGroupList returns a slice of Group values representing the specified user's group memberships. The groups' Users slice is never populated, and is always nil.
func (PostgresDataAccess) UserList ¶
UserList returns a list of all known users in the datastore. Passwords are not included. Nice try.
func (PostgresDataAccess) UserPermissionList ¶
func (da PostgresDataAccess) UserPermissionList(ctx context.Context, username string) (rest.RolePermissionList, error)
UserPermissionList returns an alphabetically-sorted list of permissions available to the specified user.
func (PostgresDataAccess) UserRoleList ¶
func (da PostgresDataAccess) UserRoleList(ctx context.Context, username string) ([]rest.Role, error)
UserRoleList returns a slice of Role values representing the specified user's indirect roles (indirect because users are members of groups, and groups have roles).
func (PostgresDataAccess) UserUpdate ¶
UserUpdate is used to update an existing user. An error is returned if the username is empty or if the user doesn't exist.