asmodel

package
v0.0.0-...-8d2fcc7 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package asmodel ...

Package asmodel ...

Package asmodel ...

Package asmodel ...

Package asmodel ...

Index

Constants

This section is empty.

Variables

View Source
var (
	GetDBConnectionFunc = common.GetDBConnection
)

Functions

func CreateUser

func CreateUser(user User) *errors.Error

CreateUser connects to the persistencemgr and creates a user in db

func DeleteUser

func DeleteUser(key string) *errors.Error

DeleteUser will delete the user entry from the database based on the uuid

func GetAllSessionKeys

func GetAllSessionKeys() ([]string, *errors.Error)

GetAllSessionKeys will collect all session keys available in the DB

func UpdateUserDetails

func UpdateUserDetails(user, newData User) *errors.Error

UpdateUserDetails will modify the current details to given changes

Types

type Account

type Account struct {
	UserName string `json:"UserName"`
	Password string `json:"Password"`
	RoleID   string `json:"RoleId"`
}

Account is the model for creating/updating an Account

type CreateSession

type CreateSession struct {
	UserName string `json:"UserName"`
	Password string `json:"Password"`
}

CreateSession will hold input request for creating a session

type OEMPrivileges

type OEMPrivileges struct {
	List []string
}

OEMPrivileges struct definition

func GetOEMPrivileges

func GetOEMPrivileges() (OEMPrivileges, *errors.Error)

GetOEMPrivileges retrives the privileges from database

func (*OEMPrivileges) Create

func (p *OEMPrivileges) Create() *errors.Error

Create method is to insert the oemprivileges list to database

type Privileges

type Privileges struct {
	List []string
}

Privileges struct definition

func GetPrivilegeRegistry

func GetPrivilegeRegistry() (Privileges, *errors.Error)

GetPrivilegeRegistry retrives the privileges from database

func (*Privileges) Create

func (p *Privileges) Create() *errors.Error

Create method is to insert the privileges list to database

type RedfishRoles

type RedfishRoles struct {
	List []string
}

RedfishRoles struct definition

func GetRedfishRoles

func GetRedfishRoles() (RedfishRoles, *errors.Error)

GetRedfishRoles retrives the privileges from database

func (*RedfishRoles) Create

func (r *RedfishRoles) Create() *errors.Error

Create method is to insert the privileges list to database

type Role

type Role struct {
	ID                 string   `json:"RoleId"`
	IsPredefined       bool     `json:"IsPredefined"`
	AssignedPrivileges []string `json:"AssignedPrivileges"`
	OEMPrivileges      []string `json:"OemPrivileges"`
}

Role struct definition

func GetAllRoles

func GetAllRoles() ([]Role, *errors.Error)

GetAllRoles gets all the roles from the db

func GetRoleDetailsByID

func GetRoleDetailsByID(roleID string) (Role, *errors.Error)

GetRoleDetailsByID retrives the privileges for a role from database

func (*Role) Create

func (r *Role) Create() *errors.Error

Create method is to insert the role details into database

func (*Role) Delete

func (r *Role) Delete() *errors.Error

Delete will delete the role entry from the database based on the uuid

func (*Role) UpdateRoleDetails

func (r *Role) UpdateRoleDetails() *errors.Error

UpdateRoleDetails will modify the current details to given changes

type Session

type Session struct {
	ID           string
	Token        string
	UserName     string
	RoleID       string
	Privileges   map[string]bool
	Origin       string
	CreatedTime  time.Time
	LastUsedTime time.Time
}

Session will hold the data assosiated with the session

func GetSession

func GetSession(token string) (Session, *errors.Error)

GetSession will get the session details from db if available

func (*Session) Delete

func (s *Session) Delete() *errors.Error

Delete will delete a session from the DB

func (*Session) Persist

func (s *Session) Persist() *errors.Error

Persist will create a session in the DB

func (*Session) Update

func (s *Session) Update() *errors.Error

Update will update a session in the DB

type User

type User struct {
	UserName     string   `json:"UserName"`
	Password     string   `json:"Password"`
	RoleID       string   `json:"RoleId"`
	AccountTypes []string `json:"AccountTypes"`
}

User is the model for User Account

func GetAllUsers

func GetAllUsers() ([]User, *errors.Error)

GetAllUsers gets all the accounts from the db

func GetUserDetails

func GetUserDetails(userName string) (User, *errors.Error)

GetUserDetails will fetch details of specific user from the db

Jump to

Keyboard shortcuts

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