validationacl

package
v0.0.0-...-db28b0c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseACL = map[string]bool{
	"roles.list":                 false,
	"roles.create":               false,
	"roles.edit":                 false,
	"roles.delete":               false,
	"users.list":                 false,
	"users.create":               false,
	"users.edit":                 false,
	"users.delete":               false,
	"jabatan.list":               false,
	"jabatan.create":             false,
	"jabatan.edit":               false,
	"jabatan.delete":             false,
	"klasifikasi.list":           false,
	"klasifikasi.create":         false,
	"klasifikasi.edit":           false,
	"klasifikasi.delete":         false,
	"karyawan.list":              false,
	"karyawan.create":            false,
	"karyawan.edit":              false,
	"karyawan.delete":            false,
	"penugasan.list":             false,
	"penugasan.create":           false,
	"penugasan.edit":             false,
	"penugasan.delete":           false,
	"persetujuan.list":           false,
	"persetujuan.create":         false,
	"persetujuan.edit":           false,
	"persetujuan.delete":         false,
	"tambah_surat_masuk.list":    false,
	"tambah_surat_masuk.create":  false,
	"tambah_surat_masuk.edit":    false,
	"tambah_surat_masuk.delete":  false,
	"surat_disposisi.list":       false,
	"surat_disposisi.create":     false,
	"surat_disposisi.edit":       false,
	"surat_disposisi.delete":     false,
	"surat_masuk.list":           false,
	"surat_masuk.create":         false,
	"surat_masuk.edit":           false,
	"surat_masuk.delete":         false,
	"histories.list":             false,
	"surat_keluar.list":          false,
	"surat_keluar.create":        false,
	"surat_keluar.edit":          false,
	"surat_keluar.delete":        false,
	"draft_surat.list":           false,
	"draft_surat.create":         false,
	"draft_surat.edit":           false,
	"draft_surat.delete":         false,
	"rekap_surat_keluar.list":    false,
	"rekap_surat_disposisi.list": false,
	"rekap_surat_masuk.list":     false,
	"rekap_ctu.list":             false,
	"rekap_ctu.edit":             false,
	"rekap_itu.list":             false,
	"rekap_itu.edit":             false,
	"rekap_pst.list":             false,
	"rekap_pst.edit":             false,
	"tracking_surat.list":        false,
	"penomoran_draft_surat.list": false,
	"penomoran_draft_surat.edit": false,
}

Functions

func GetMeHandler

func GetMeHandler(c *fiber.Ctx) error

func ValidatePermission

func ValidatePermission(ctx *app.Ctx, aclKey string) error

Types

type AclKeys

type AclKeys struct {
	db.NullJSON
	Data map[string]bool
}

type List

type List struct {
	app.ListModel
	Results []UserACL `json:"results"`
}

type UserACL

type UserACL struct {
	db.Model
	ID                    db.NullInt64    `json:"id"                      db:"u.id"                   gorm:"column:id"`
	Username              db.NullString   `json:"username"                db:"u.username"             gorm:"column:username"         form:"username"`
	JobTitle              db.NullString   `json:"jobtitle"                db:"u.job_title"            gorm:"column:job_title"        form:"jobtitle"`
	IpAddress             db.NullString   `json:"ipaddress"               db:"u.ip_address"           gorm:"column:ip_address"       form:"ipaddress"`
	CreatedOn             db.NullInt64    `json:"created"                 db:"u.created_on"           gorm:"column:created_on"       form:"created"`
	LastLogin             db.NullInt64    `json:"last_login"              db:"u.last_login"           gorm:"column:last_login"       form:"last_login"`
	CreatedOnText         db.NullString   `json:"created"                 db:"u.created_on"           gorm:"column:created_on"`
	LastLoginText         db.NullString   `json:"last_login"              db:"u.last_login"           gorm:"column:last_login"`
	Active                db.NullBool     `json:"active"                  db:"u.active"               gorm:"column:active"           form:"active"`
	FirstName             db.NullString   `json:"firstname"               db:"u.first_name"           gorm:"column:first_name"       form:"firstname"`
	LastName              db.NullString   `json:"lastname"                db:"u.last_name"            gorm:"column:last_name"        form:"lastname"`
	Phone                 db.NullString   `json:"phone"                   db:"u.phone"                gorm:"column:phone"            form:"phone"`
	PictureUrl            db.NullString   `json:"picture"                 db:"u.picture"              gorm:"column:picture"          form:"-"`
	PictureFileName       db.NullString   `json:"picture_filename"        db:"u.picture_filename"     gorm:"column:picture_filename" form:"-"`
	ParentPmkId           db.NullInt64    `json:"parent_jabatan.id"       db:"u.staff_pmk_id"         gorm:"column:staff_pmk_id"     form:"parent_jabatan[id]"`
	ParentPmkName         db.NullString   `json:"parent_jabatan.name"     db:"pj.pmk_nama"            gorm:"-"                       form:"parent_jabatan.name"`
	JabatanUtamaID        db.NullInt64    `json:"jabatan_utama.id"        db:"ju.pmk_id"              gorm:"-"                       form:"jabatan_utama[id]"`
	JabatanUtamaName      db.NullString   `json:"jabatan_utama.name"      db:"ju.pmk_nama"            gorm:"-"                       form:"jabatan_utama.name"`
	SekretarisJabatanID   db.NullInt64    `json:"jabatan_sekretaris.id"   db:"js.pmk_id"              gorm:"-"                       form:"jabatan_sekretaris[id]"`
	SekretarisJabatanName db.NullString   `json:"jabatan_sekretaris.name" db:"js.pmk_nama"            gorm:"-"                       form:"jabatan_sekretaris.name"`
	PLT                   []UserPLT       `json:"plt"                     db:"plt.pmk_plt_user_id=id" gorm:"-"                       form:"-"`
	Email                 db.NullString   `json:"email"                   db:"u.email"                gorm:"column:email"            form:"email"`
	LdapUsername          db.NullString   `json:"ldap_username"           db:"u.ldap_username"        gorm:"column:ldap_username"    form:"ldap_username"`
	Roles                 []UserRolesACL  `json:"roles"                   db:"ug.user_id=id"          gorm:"-"`
	ACL                   map[string]bool `json:"acl"                     db:"-"                      gorm:"-"`
}

func GetMe

func GetMe(ctx *app.Ctx, id string, query url.Values) (UserACL, error)

func (*UserACL) SetFilter

func (u *UserACL) SetFilter()

func (*UserACL) SetRelation

func (u *UserACL) SetRelation()

func (*UserACL) SetSort

func (u *UserACL) SetSort()

func (UserACL) TableAliasName

func (UserACL) TableAliasName() string

func (UserACL) TableName

func (UserACL) TableName() string

func (UserACL) TableVersion

func (UserACL) TableVersion() string

type UserPLT

type UserPLT struct {
	db.Model
	ID     db.NullInt64  `json:"id"   db:"plt.pmk_id"          gorm:"column:pmk_id;primaryKey" form:"id"`
	UserID db.NullInt64  `json:"-"    db:"plt.pmk_plt_user_id" gorm:"column:pmk_plt_user_id"   form:"-"`
	Name   db.NullString `json:"name" db:"plt.pmk_nama"        gorm:"column:pmk_nama"          form:"name"`
}

func (UserPLT) TableAliasName

func (UserPLT) TableAliasName() string

func (UserPLT) TableName

func (UserPLT) TableName() string

type UserRolesACL

type UserRolesACL struct {
	db.Model
	ID          db.NullInt64  `json:"-"           db:"ug.id"           gorm:"column:id;primaryKey"`
	UserID      db.NullInt64  `json:"-"           db:"ug.user_id"      gorm:"column:user_id"`
	RoleID      db.NullInt64  `json:"id"          db:"ug.group_id"     gorm:"column:group_id"`
	IsAdmin     db.NullBool   `json:"is_admin"    db:"g.is_admin"      gorm:"-"`
	Name        db.NullString `json:"name"        db:"g.name"          gorm:"-"`
	Description db.NullString `json:"description" db:"g.description"   gorm:"-"`
	ACL         AclKeys       `json:"acl_keys"    db:"g.acl_keys~json" gorm:"-"`
}

func (*UserRolesACL) SetRelation

func (au *UserRolesACL) SetRelation()

func (UserRolesACL) TableAliasName

func (UserRolesACL) TableAliasName() string

func (UserRolesACL) TableName

func (UserRolesACL) TableName() string

Jump to

Keyboard shortcuts

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