shared_account

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AdminLevel    = 0
	StandardLevel = 1
	ReadLevel     = 2
	DatabaseError = "Error while getting data from database"
)

Variables

View Source
var (
	ErrorInviteNewUser = errors.New("An error occured while inviting a new user. Please, try again.")
	ErrorInviteUser    = errors.New("An error occured while inviting a user. Please, try again.")
	ErrorAlreadyShared = errors.New("You are already sharing this account with this user.")
)

Functions

func DeleteSharedUser

func DeleteSharedUser(ctx context.Context, db models.XODB, shareId int) error

DeleteSharedUser deletes a user access to an AWS account by removing entry in shared_account database table.

func InviteUserWithValidBody

func InviteUserWithValidBody(request *http.Request, body InviteUserRequest, accountId int, tx *sql.Tx, user users.User) (int, interface{})

inviteUserWithValidBody tries to share an account with a specific user

func UpdateSharedUser

func UpdateSharedUser(ctx context.Context, db models.XODB, shareId int, permissionLevel int) (interface{}, error)

UpdateSharedUser updates user permission level

Types

type InviteUserRequest

type InviteUserRequest struct {
	Email           string `json:"email" req:"nonzero"`
	PermissionLevel int    `json:"permissionLevel"`
}

inviteUserRequest is the expected request body for the invite user route handler.

type SharedResults

type SharedResults struct {
	ShareId       int    `json:"sharedId" req:"nonzero"`
	Mail          string `json:"email" req:"nonzero"`
	Level         int    `json:"level"`
	UserId        int    `json:"userId" req:"nonzero"`
	SharingStatus bool   `json:"sharingStatus"`
}

func GetSharingList

func GetSharingList(ctx context.Context, db models.XODB, accountId int) ([]SharedResults, error)

GetSharingList returns a list of users who have access to a specific AWS account

Jump to

Keyboard shortcuts

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