Documentation ¶
Index ¶
- func AppendToACL(projectUUID string, resourceType string, resourceName string, acl []string, ...) error
- func AppendToUserProjects(userUUID string, projectUUID string, store stores.Store, pRoles ...string) error
- func AreValidUsers(projectUUID string, users []string, store stores.Store) (bool, error)
- func Authenticate(projectUUID string, token string, store stores.Store) ([]string, string)
- func Authorize(resource string, roles []string, store stores.Store) bool
- func ExistsWithName(name string, store stores.Store) bool
- func ExistsWithUUID(uuid string, store stores.Store) bool
- func GenToken() (string, error)
- func GetNameByUUID(uuid string, store stores.Store) string
- func GetUUIDByName(name string, store stores.Store) string
- func IsConsumer(roles []string) bool
- func IsProjectAdmin(roles []string) bool
- func IsPublisher(roles []string) bool
- func IsPushWorker(roles []string) bool
- func IsRoleValid(role string, validRoles []string) bool
- func IsServiceAdmin(roles []string) bool
- func ModACL(projectUUID string, resourceType string, resourceName string, acl []string, ...) error
- func PerResource(project string, resType string, resName string, userUUID string, ...) bool
- func RemoveFromACL(projectUUID string, resourceType string, resourceName string, acl []string, ...) error
- func RemoveUser(uuid string, store stores.Store) error
- type ACL
- type PaginatedUsers
- type ProjectRoles
- type User
- func CreateUser(uuid string, name string, projectList []ProjectRoles, token string, ...) (User, error)
- func GetPushWorker(pwToken string, store stores.Store) (User, error)
- func GetUserByToken(token string, store stores.Store) (User, error)
- func GetUserByUUID(uuid string, store stores.Store) (User, error)
- func GetUserFromJSON(input []byte) (User, error)
- func NewUser(uuid string, projects []ProjectRoles, name string, token string, email string, ...) User
- func UpdateUser(uuid string, name string, projectList []ProjectRoles, email string, ...) (User, error)
- func UpdateUserToken(uuid string, token string, store stores.Store) (User, error)
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToACL ¶
func AppendToACL(projectUUID string, resourceType string, resourceName string, acl []string, store stores.Store) error
AppendToACL is used to append unique users to a topic's or sub's ACL
func AppendToUserProjects ¶
func AppendToUserProjects(userUUID string, projectUUID string, store stores.Store, pRoles ...string) error
AppendToUserProjects appends a unique project to the user's project list
func AreValidUsers ¶
AreValidUsers accepts a user array of usernames and checks if users exist in the store
func Authenticate ¶
Authenticate based on token
func ExistsWithName ¶
ExistsWithName returns true if a user with name exists
func ExistsWithUUID ¶
ExistsWithUUID return true if a user with uuid exists
func GetNameByUUID ¶
GetNameByUUID queries user by UUID and returns the user's name. If not found, returns an empty string
func GetUUIDByName ¶
GetUUIDByName queries user by name and returns the corresponding UUID
func IsProjectAdmin ¶
IsProjectAdmin checks if the user is a project admin
func IsPushWorker ¶
IsPushWorker Checks if a user is a push worker
func IsRoleValid ¶
IsRoleValid checks if a role is a valid against a list of valid roles
func IsServiceAdmin ¶
IsServiceAdmin checks if the user is a service admin
func ModACL ¶
func ModACL(projectUUID string, resourceType string, resourceName string, acl []string, store stores.Store) error
ModACL is called to modify an acl
func PerResource ¶
func PerResource(project string, resType string, resName string, userUUID string, store stores.Store) bool
PerResource (for topics and subscriptions)
Types ¶
type ACL ¶
type ACL struct {
AuthUsers []string `json:"authorized_users"`
}
ACL holds the authorized users for a resource (topic/subscription)
func GetACL ¶
func GetACL(projectUUID string, resourceType string, resourceName string, store stores.Store) (ACL, error)
GetACL returns an authorized list of user for the resource (topic or subscription)
func GetACLFromJSON ¶
GetACLFromJSON retrieves ACL info from JSON
func (*ACL) ExportJSON ¶
ExportJSON export topic acl body to json for use in http response
type PaginatedUsers ¶
type PaginatedUsers struct { Users []User `json:"users"` NextPageToken string `json:"nextPageToken"` TotalSize int32 `json:"totalSize"` }
PaginatedUsers holds information about a users' page and how to access the next page
func PaginatedFindUsers ¶
func PaginatedFindUsers(pageToken string, pageSize int32, projectUUID string, priviledged bool, store stores.Store) (PaginatedUsers, error)
PaginatedFindUsers returns a page of users
func (*PaginatedUsers) ExportJSON ¶
func (pus *PaginatedUsers) ExportJSON() (string, error)
ExportJSON exports Paginated users list to json format
type ProjectRoles ¶
type ProjectRoles struct { Project string `json:"project"` Roles []string `json:"roles"` Topics []string `json:"topics"` Subs []string `json:"subscriptions"` }
ProjectRoles is the struct that hold project and role information of the user
type User ¶
type User struct { UUID string `json:"uuid"` Projects []ProjectRoles `json:"projects"` Name string `json:"name"` Token string `json:"token,omitempty"` Email string `json:"email"` ServiceRoles []string `json:"service_roles"` CreatedOn string `json:"created_on,omitempty"` ModifiedOn string `json:"modified_on,omitempty"` CreatedBy string `json:"created_by,omitempty"` }
User is the struct that holds user information
func CreateUser ¶
func CreateUser(uuid string, name string, projectList []ProjectRoles, token string, email string, serviceRoles []string, createdOn time.Time, createdBy string, store stores.Store) (User, error)
CreateUser creates a new user
func GetPushWorker ¶
GetPushWorker returns a push worker user by token
func GetUserByToken ¶
GetUserByToken returns a specific user by his token
func GetUserByUUID ¶
GetUserByUUID returns user information by UUID
func GetUserFromJSON ¶
GetUserFromJSON retrieves User info From JSON string
func NewUser ¶
func NewUser(uuid string, projects []ProjectRoles, name string, token string, email string, serviceRoles []string, createdOn time.Time, modifiedOn time.Time, createdBy string) User
NewUser accepts parameters and creates a new user
func UpdateUser ¶
func UpdateUser(uuid string, name string, projectList []ProjectRoles, email string, serviceRoles []string, modifiedOn time.Time, store stores.Store) (User, error)
UpdateUser updates an existing user's information
func UpdateUserToken ¶
UpdateUserToken updates an existing user's token
func (*User) ExportJSON ¶
ExportJSON exports User to json format
type Users ¶
type Users struct {
List []User `json:"users,omitempty"`
}
Users holds a list of available users
func FindUsers ¶
func FindUsers(projectUUID string, uuid string, name string, priviledged bool, store stores.Store) (Users, error)
FindUsers returns a specific user or a list of all available users belonging to a project in the datastore.
func (*Users) ExportJSON ¶
ExportJSON exports Users list to json format