actions

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add2FaSession

func Add2FaSession(secret string, owner string)

func AddRefreshToken

func AddRefreshToken(tkn *models.RefreshTokenModel)

func AddTableEntry

func AddTableEntry(displayname string, Tablename string, row map[string]interface{}) bool

/////////////////////////////////// Adds entry to given table // returns status of action // ///////////////////////////////////

func AddUser

func AddUser(username string, hash string, root bool, mail string, status string)

//////////////////////////// Adds user to system // ////////////////////////////

func ChangeNumOfEntrysBy

func ChangeNumOfEntrysBy(tablename string, indicator int)

//////////////////////////////////// Changes number of table entrys // by indicator // ////////////////////////////////////

func CheckColumnNames

func CheckColumnNames(columns []models.RowConfigModel) bool

///////////////////////////////////// checks if column names are valid // /////////////////////////////////////

func CheckIfTableExists

func CheckIfTableExists(name string) bool

//////////////////////////////////////// Checks if table exists // ////////////////////////////////////////

func CheckUserHasHigherPermission

func CheckUserHasHigherPermission(conn *sql.DB, username string, permLevel int, permName string) bool

///////////////////////////////////////////// Checks if user has higher permission // than other user // /////////////////////////////////////////////

func CheckUserOwnsRefreshToken

func CheckUserOwnsRefreshToken(user string, token string) bool

func CreateTable

func CreateTable(displayname string, Tablename string, RowConfig []models.RowConfigModel, MinPermLvl int) bool

////////////////////////////////// Creates a table // //////////////////////////////////

func DeleteTableEntry

func DeleteTableEntry(entryID int, tablename string) bool

/////////////////////////////// Deletes an table entry // of given table // ///////////////////////////////

func DeleteUser

func DeleteUser(username string)

//////////////////////////////////////// Deletes an user from the database // ////////////////////////////////////////

func DropTable

func DropTable(tablename string)

//////////////////////////////////////////// Deletes an database table completely // ////////////////////////////////////////////

func GetAll2FaSessions

func GetAll2FaSessions() []models.TwoFactorModel

func GetAll2FaSessionsOfUser

func GetAll2FaSessionsOfUser(owner string) []models.TwoFactorModel

func GetAllPermissions

func GetAllPermissions() []models.PermissionModel

////////////////////////////////////// Queries all permission group // //////////////////////////////////////

func GetAllPermissionsWithHigherPermLvl

func GetAllPermissionsWithHigherPermLvl(minPermLvl int) []models.PermissionModel

/////////////////////////////////////////////// Queries all permission groups with higher // permission level than the given // ///////////////////////////////////////////////

func GetAllTables

func GetAllTables(username string) []models.TableModel

////////////////////////////////// Queries all tables // //////////////////////////////////

func GetAllUser

func GetAllUser() []models.UserModel

//////////////////////////// Queries all user // ////////////////////////////

func GetConn

func GetConn() (conn *sql.DB)

/////////////////////////////////// opens connection to database // ///////////////////////////////////

func GetHighestPermission

func GetHighestPermission(conn *sql.DB, username string) int

///////////////////////////////////////// returns highest permission of // given user // /////////////////////////////////////////

func GetPermissionByName

func GetPermissionByName(name string) (bool, models.PermissionModel)

////////////////////////////////////////// Queries permission with specific name // //////////////////////////////////////////

func GetPermissionsOfUser

func GetPermissionsOfUser(username string) []models.PermissionModel

////////////////////////////////////// Queries all permissions of user // //////////////////////////////////////

func GetRefreshToken

func GetRefreshToken(token string) (bool, models.RefreshTokenModel)

func GetTableByName

func GetTableByName(name string) models.TableModel

/////////////////////////////////////// Queries table with specific name // ///////////////////////////////////////

func GetUserByUsername

func GetUserByUsername(username string) (bool, models.UserModel)

/////////////////////////////// Queries user by username // ///////////////////////////////

func GetUsersByPermission

func GetUsersByPermission(permission string) []models.UserModel

//////////////////////////////// Queries all user with // specific permission // ////////////////////////////////

func InsertPermissionGroup

func InsertPermissionGroup(name string, color string, permLevel int)

////////////////////////////// Creates permission group // //////////////////////////////

func MysqlLogin

func MysqlLogin(username string, password string) (bool, string)

////////////////////////////////////// Checks login status of user // by username and password // //////////////////////////////////////

func ParseToArray

func ParseToArray(input map[string]interface{}, columns []string) []interface{}

parse map to value array needs static map and column names

func RenameTable

func RenameTable(oldname string, newname string) bool

////////////////////////////////// Renames the given table // //////////////////////////////////

func RenameTableColumn

func RenameTableColumn(tablename string, oldname string, newname string, datatype string, length string) bool

////////////////////////////////// Renames a column of table // //////////////////////////////////

func RevokeSession

func RevokeSession(user string, token string)

func UpdateTableMinPermLvl

func UpdateTableMinPermLvl(tablename string, newLvl int)

////////////////////////////////// Updates perm level of table // //////////////////////////////////

func UpdateTablename

func UpdateTablename(old string, new string)

///////////////////////////////// Updates tablename in internal // inv_tables table // /////////////////////////////////

func UpdateUser2FA

func UpdateUser2FA(username string, status bool)

func UpdateUserPermission

func UpdateUserPermission(username string, permissions string)

////////////////////////////////// Updates permission of user // //////////////////////////////////

func UpdateUserRoor

func UpdateUserRoor(root bool, username string)

Types

type Column

type Column struct {
	COLUMN_NAME string      `json:"COLUMN_NAME"`
	DATA_TYPE   string      `json:"DATA_TYPE"`
	MAX_LENGTH  interface{} `json:"CHARACTER_MAXIMUM_LENGTH"`
}

global struct

func GetTableColumns

func GetTableColumns(displayname string, Tablename string) []Column

/////////////////////////////////////////// Queries all columns of specific table // ///////////////////////////////////////////

func SelectColumnScheme

func SelectColumnScheme(tablename string) (bool, []Column)

/////////////////////////////////// Queries column scheme of table // ///////////////////////////////////

type Entries

type Entries struct {
	Entries int `json:"entries"`
}

Jump to

Keyboard shortcuts

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