user

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 18 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.1.0 - 2022-03-

  • First official release. Working on the xmodules/base, Xamboo, XCore, XDominion and XMask of this date.
  • Admin pages integrated in xmodule

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"


  1. Normalization

All the concept of the module must be called by se same ywa among messages, screens and data. English:

  • Group of right accesses
  • Right access
  • User Profile
  • Administration User Spanish:
  • Grupo de permisos de accesos
  • Permiso de Acceso
  • Perfil de usuario
  • Usuario Administrador French:
  • Groupe d'accès
  • Droit d'accès
  • Profil d'utilisateur
  • Utilisateur administrateur

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

This section is empty.

Variables

This section is empty.

Functions

func AddAccess

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

func AddAccessGroup

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

AddAccessGroup is generally used by xmodules installers

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 DeleteAccessChildren added in v0.0.16

func DeleteAccessChildren(ds applications.Datasource, skey string) error

func DeleteAccessGroupChildren added in v0.0.16

func DeleteAccessGroupChildren(ds applications.Datasource, skey string) error

func DeleteProfileChildren added in v0.0.16

func DeleteProfileChildren(ds applications.Datasource, skey string) error

func DeleteUserChildren added in v0.0.16

func DeleteUserChildren(ds applications.Datasource, key int) error

func DestroySessionUser

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

func GetAccessByKey added in v0.0.16

func GetAccessByKey(ds applications.Datasource, key string) *xdominion.XRecord

func GetAccessByQuery added in v0.0.16

func GetAccessByQuery(ds applications.Datasource, cond *xdominion.XConditions, order *xdominion.XOrder) *xdominion.XRecord

func GetAccessGroupsCount added in v0.0.16

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

func GetAccessGroupsList added in v0.0.16

func GetAccessGroupsList(ds applications.Datasource, cond *xdominion.XConditions, order *xdominion.XOrder, quantity int, first int) *xdominion.XRecords

func GetAccessProfiles added in v0.0.16

func GetAccessProfiles(ds applications.Datasource, access string, quantity int) (*xdominion.XRecords, error)

func GetAccessUsers added in v0.0.16

func GetAccessUsers(ds applications.Datasource, access string, quantity int) (*xdominion.XRecords, error)

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

func GetAccessesCount added in v0.0.16

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

func GetAccessesList

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

func GetProfileAccesses added in v0.0.16

func GetProfileAccesses(ds applications.Datasource, profile string, quantity int) (*xdominion.XRecords, error)

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

func GetProfileUsers added in v0.0.16

func GetProfileUsers(ds applications.Datasource, profilekey string, quantity int) (*xdominion.XRecords, error)

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

func GetProfilesCount added in v0.0.16

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

func GetProfilesList added in v0.0.16

func GetProfilesList(ds applications.Datasource, cond *xdominion.XConditions, order *xdominion.XOrder, quantity int, first int) *xdominion.XRecords

func GetSession

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

func GetUserAccessByKeys added in v0.0.16

func GetUserAccessByKeys(ds applications.Datasource, userkey int, accesskey string) *xdominion.XRecord

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

func GetUserAccesses added in v0.0.16

func GetUserAccesses(ds applications.Datasource, userkey int, quantity int) (*xdominion.XRecords, error)

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

func GetUserByKey added in v0.0.16

func GetUserByKey(ds applications.Datasource, key int) *xdominion.XRecord

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

func GetUserParam

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

func GetUserProfiles added in v0.0.16

func GetUserProfiles(ds applications.Datasource, userkey int, quantity int) (*xdominion.XRecords, error)

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

func GetUsersCount added in v0.0.16

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

func GetUsersList

func GetUsersList(ds applications.Datasource, cond *xdominion.XConditions, order *xdominion.XOrder, quantity int, first int) *xdominion.XRecords

func HasAccess

func HasAccess(ds applications.Datasource, userid int, args ...interface{}) bool

SECURITY Access

func PruneAccessChildren added in v0.0.16

func PruneAccessChildren(ds applications.Datasource, skey string, group string) error

func PruneAccessGroupChildren added in v0.0.16

func PruneAccessGroupChildren(ds applications.Datasource, skey string, group string) error

func PruneProfileChildren added in v0.0.16

func PruneProfileChildren(ds applications.Datasource, skey string, profile string) error

func PruneUserChildren added in v0.0.16

func PruneUserChildren(ds applications.Datasource, key int, user int) error

func SetProfileAccess added in v0.0.16

func SetProfileAccess(ds applications.Datasource, profile string, access string, status bool) error

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

func SetUserAccess added in v0.0.16

func SetUserAccess(ds applications.Datasource, user int, access string, status int) error

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

func SetUserParam

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

func SetUserProfile added in v0.0.16

func SetUserProfile(ds applications.Datasource, user int, profile string, status bool) error

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

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 GetUserByCredentials

func GetUserByCredentials(ds applications.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