user_api

package
v0.0.0-...-0600186 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_CONTENT_TYPE = "application/vnd.com.nsn.cumulocity.user+json;ver=0.9"
	USER_ACCEPT       = "application/vnd.com.nsn.cumulocity.user+json;ver=0.9"

	INVENTORY_ROLE_CONTENT_TYPE = "application/vnd.com.nsn.cumulocity.inventoryrole+json"
)

Variables

View Source
var TestInventoryRolesJSON = `` /* 1349-byte string literal not displayed */

Functions

This section is empty.

Types

type CreateUser

type CreateUser struct {
	Username          string      `json:"userName"`
	Password          string      `json:"password"`
	FirstName         string      `json:"firstName"`
	LastName          string      `json:"lastName"`
	Phone             string      `json:"phone"`
	Email             string      `json:"email"`
	Enabled           bool        `json:"enabled"`
	DevicePermissions interface{} `json:"devicePermissions"`
}

type CurrentUser

type CurrentUser struct {
	ID                  string      `json:"id"`
	Self                string      `json:"self"`
	Username            string      `json:"userName"`
	FirstName           string      `json:"firstName"`
	LastName            string      `json:"lastName"`
	Phone               string      `json:"phone"`
	Email               string      `json:"email"`
	Enabled             bool        `json:"enabled"`
	DevicePermissions   interface{} `json:"devicePermissions"`
	EffectiveRoles      []Role      `json:"effectiveRoles"`
	ShouldResetPassword bool        `json:"shouldResetPassword"`
	LastPasswordChange  time.Time   `json:"lastPasswordChange"`
}

type Group

type Group struct {
	ID                string      `json:"id"`
	Self              string      `json:"self"`
	Name              string      `json:"name"`
	Roles             []Role      `json:"roles"`
	DevicePermissions interface{} `json:"devicePermissions"`
}

type GroupReferenceCollection

type GroupReferenceCollection struct {
	Self       string                    `json:"self"`
	Next       string                    `json:"next"`
	Prev       string                    `json:"prev"`
	Groups     []Group                   `json:"groups"`
	Statistics *generic.PagingStatistics `json:"statistics"`
}

type InventoryRole

type InventoryRole struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Self        string       `json:"self"`
	ID          int          `json:"id"`
	Permissions []Permission `json:"permissions"`
}

type InventoryRolesCollection

type InventoryRolesCollection struct {
	Self       string                    `json:"self"`
	Next       string                    `json:"next"`
	Prev       string                    `json:"prev"`
	Roles      []InventoryRole           `json:"roles"`
	Statistics *generic.PagingStatistics `json:"statistics"`
}

type Permission

type Permission struct {
	ID         int    `json:"id"`
	Permission string `json:"permission"`
	Type       string `json:"type"`
	Scope      string `json:"scope"`
}

type QueryFilter

type QueryFilter struct {
	Username          string
	Groups            []Group
	Owner             string
	OnlyDevices       bool
	WithSubUsersCount bool
}

func (QueryFilter) QueryParams

func (q QueryFilter) QueryParams(params *url.Values) error

type Role

type Role struct {
	ID   string `json:"id"`
	Self string `json:"self"`
	Name string `json:"name"`
}

type RoleCollection

type RoleCollection struct {
	Self       string                    `json:"self"`
	Next       string                    `json:"next"`
	Prev       string                    `json:"prev"`
	Roles      []Role                    `json:"roles"`
	Statistics *generic.PagingStatistics `json:"statistics"`
}

type RoleReference

type RoleReference struct {
	Self string `json:"self"`
	Role Role   `json:"role"`
}

type RoleReferenceCollection

type RoleReferenceCollection struct {
	Self       string                    `json:"self"`
	Next       string                    `json:"next"`
	Prev       string                    `json:"prev"`
	References []RoleReference           `json:"references"`
	Statistics *generic.PagingStatistics `json:"statistics"`
}

type User

type User struct {
	ID       string `json:"id"`
	Self     string `json:"self"`
	Username string `json:"userName"`
	//Password          string      `json:"password"`
	FirstName         string      `json:"firstName"`
	LastName          string      `json:"lastName"`
	Phone             string      `json:"phone"`
	Email             string      `json:"email"`
	Enabled           bool        `json:"enabled"`
	Groups            []Group     `json:"groups"`
	Roles             []Role      `json:"roles"`
	DevicePermissions interface{} `json:"devicePermissions"`
}

func (User) HasDevicePermissions

func (u User) HasDevicePermissions() bool

type UserApi

type UserApi interface {
	CreateUser(tenantID string, model *CreateUser) (*User, *generic.Error)
	UserCollection(filter *QueryFilter, pageSize int) (*UserCollection, *generic.Error)
	GetCurrentUser() (*CurrentUser, *generic.Error)
	UserByName(tenantID, username string) (*User, *generic.Error)
	FindUserCollection(userQuery *QueryFilter, pageSize int) (*UserCollection, *generic.Error)
	NextPageUserCollection(r *UserCollection) (*UserCollection, *generic.Error)
	PreviousPageUserCollection(r *UserCollection) (*UserCollection, *generic.Error)

	RoleCollection(pageSize int) (*RoleCollection, *generic.Error)
	FindRoleCollection(pageSize int) (*RoleCollection, *generic.Error)
	NextPageRoleCollection(r *RoleCollection) (*RoleCollection, *generic.Error)
	PreviousPageRoleCollection(r *RoleCollection) (*RoleCollection, *generic.Error)
	FindRoleReferenceCollection(tenantID, username, groupID string, pageSize int) (*RoleReferenceCollection, *generic.Error)
	AssignRoleToUser(tenantID, username string, reference *RoleReference) (*RoleReference, *generic.Error)
	AssignRoleToGroup(tenantID, groupID string, reference *RoleReference) (*RoleReference, *generic.Error)
	UnassignRoleFromUser(tenantID, username, roleName string) *generic.Error
	UnassignRoleFromGroup(tenantID, groupID, roleName string) *generic.Error
	GetAllRolesOfAUser(tenantID, username string, pageSize int) (*RoleReferenceCollection, *generic.Error)
	GetAllRolesOfAGroup(tenantID, groupID string, pageSize int) (*RoleReferenceCollection, *generic.Error)

	GroupDetails(groupID string) (*Group, *generic.Error)
	GroupByName(tenantID, groupName string) (*Group, *generic.Error)
	RemoveGroup(tenantID, groupID string) *generic.Error
	UpdateGroup(tenantID, groupID string, group *Group) (*Group, *generic.Error)
	GetAllGroupsOfUser(tenantID, username string, pageSize int) (*GroupReferenceCollection, *generic.Error)
	FindGroupReferenceCollection(tenantID, username string, pageSize int) (*GroupReferenceCollection, *generic.Error)
	NextPageGroupReferenceCollection(r *GroupReferenceCollection) (*GroupReferenceCollection, *generic.Error)
	PreviousPageGroupCollection(r *GroupReferenceCollection) (*GroupReferenceCollection, *generic.Error)

	InventoryRoleCollection() (*InventoryRolesCollection, *generic.Error)
	NextPageInventoryRoleCollection(i *InventoryRolesCollection) (*InventoryRolesCollection, *generic.Error)
	PreviousPageInventoryRoleCollection(i *InventoryRolesCollection) (*InventoryRolesCollection, *generic.Error)
	AssignNewInventoryRole(role *InventoryRole) (*InventoryRole, *generic.Error)
	InventoryRole(id int) (*InventoryRole, *generic.Error)
	UpdateInventoryRole(id int, role *InventoryRole) (*InventoryRole, *generic.Error)
	DeleteInventoryRole(id int) *generic.Error
}

func NewUserApi

func NewUserApi(client *generic.Client) UserApi

type UserCollection

type UserCollection struct {
	Self       string                    `json:"self"`
	Users      []User                    `json:"users"`
	Statistics *generic.PagingStatistics `json:"statistics"`
	Prev       string                    `json:"prev"`
	Next       string                    `json:"next"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL