user

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 17 Imported by: 0

README

Go Report Card GoDoc GolangCI

xmodules/user for Xamboo - GO

The user package is used to build a set of administration users with all the security controls needed:

  • accesses (simple named accesses)
  • extended accesses (based on the records of a table)
  • sessions and history
  • profiles
  • per-user accesses adjustements

Version Changes Control

v0.0.1 - 2020-05-08

  • Compatible with xmodule context standard

v0.0.0 - 2020-03-05

  • Support for multithread context implemented

v0.0.0 - 2020-01-23

  • BuildCaches is now on parallel thread

v0.0.0 - 2020-01-03

  • This document added
  • Order added to synchronize tables in database (due to hierarchy of FK-PK)

v0.0.0 - 2019-12-18

  • First release of module

Manual:

I. Users

Intro


  1. Overview

Example:

import "github.com/webability-go/xmodules/user"


  1. Reference

To use the package:

import "github.com/webability-go/xmodules/user"

Documentation

Overview

Package user contains the list of administrative user for the system. All users have accesses, into a profile and even extended access based upon table records. It needs context xmodule.

Index

Constants

View Source
const (
	MODULEID = "user"
	VERSION  = "0.0.1"
)

Variables

View Source
var ModuleUser = assets.ModuleEntries{

	GetAccessesCount: GetCountAccesses,
	GetAccessesList:  GetAccessesList,

	HasAccess: HasAccess,

	SetUserParam: SetUserParam,
	AddUserParam: AddUserParam,
	GetUserParam: GetUserParam,
	DelUserParam: DelUserParam,
}
View Source
var Needs = []string{"base"}

Functions

func AddAccess

func AddAccess(ds applications.Datasource, access *assets.Access) error

func AddAccessGroup

func AddAccessGroup(ds applications.Datasource, accessgroup *assets.AccessGroup) error

func AddUserParam

func AddUserParam(ds applications.Datasource, user int, param string, value interface{})

func CloseSession

func CloseSession(ds *base.Datasource, sessionid string) string

func CreateSession

func CreateSession(ds *base.Datasource, key int, sessionid string, IP string, origin string, device string) string

func CreateSessionUser

func CreateSessionUser(ctx *context.Context, xds applications.Datasource, sessionid string, IP string, origin string, device string, user *StructureUser) string

func CreateStructureUserByData

func CreateStructureUserByData(ds applications.Datasource, data xdominion.XRecordDef) base.Structure

func CreateStructureUserByKey

func CreateStructureUserByKey(ds applications.Datasource, key int) base.Structure

func DelUserParam

func DelUserParam(ds applications.Datasource, user int, param string)

func DestroySessionUser

func DestroySessionUser(ctx *context.Context, xds applications.Datasource, sessionid string)

func GetAccessesList

func GetAccessesList(ds applications.Datasource, cond *xdominion.XConditions, orderby *xdominion.XOrderBy, quantity int, first int) *xdominion.XRecords

func GetCountAccesses

func GetCountAccesses(ds applications.Datasource, cond *xdominion.XConditions) int

func GetSession

func GetSession(ds *base.Datasource, sessionid string) *xdominion.XRecord

func GetUserParam

func GetUserParam(ds applications.Datasource, user int, param string) string

func GetUsersList

func GetUsersList(ds *base.Datasource) *xdominion.XRecords

GetUsersList to get a list of all the users

func HasAccess

func HasAccess(ds applications.Datasource, clientid int, access string, extra string) bool

SECURITY Access

func SetUserParam

func SetUserParam(ds applications.Datasource, user int, param string, value interface{})

func Setup

func Setup(ds applications.Datasource, prefix string) ([]string, error)

InitModule is called during the init phase to link the module with the system adds tables and caches to sitecontext::database

func StartContext

func StartContext(ds applications.Datasource, ctx *context.Context) error

func Synchronize

func Synchronize(ds applications.Datasource, prefix string) ([]string, error)

func VerifyUserSession

func VerifyUserSession(ctx *context.Context, xds applications.Datasource, origin string, device string)

SESSIONS

Types

type StructureUser

type StructureUser struct {
	Key  int
	Data *xdominion.XRecord
}

func GetUser

func GetUser(ds *base.Datasource, key int) *StructureUser

GetCountry to get the data of a country from cache/db in the specified language

func GetUserByCredentials

func GetUserByCredentials(ds *base.Datasource, username string, password string) *StructureUser

func (*StructureUser) Clone

func (sm *StructureUser) Clone() base.Structure

Clone the whole structure

func (*StructureUser) ComplementData

func (sm *StructureUser) ComplementData(ds applications.Datasource)

ComplementData adds all the needed data from other objects /duplicable in the thread since the object will be destroyed at the end

func (*StructureUser) GetData

func (sm *StructureUser) GetData() *xdominion.XRecord

Returns the raw data

func (*StructureUser) IsAuthorized

func (sm *StructureUser) IsAuthorized(ds applications.Datasource, site string, language string, device string) bool

IsAuthorized returns true if the structure can be used on this site/language/device

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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