Documentation ¶
Overview ¶
Package Auth
Index ¶
- func Checklogin(Lc LoginCheck, db *gorm.DB, secretkey string) (string, int, error)
- func CreateToken(userid, roleid int, secretkey string) (string, error)
- func Difference(a, b []int) (diff []int)
- func MigrationTable(db *gorm.DB)
- func VerifyToken(token string, secret string) (userid, roleid int, err error)
- func VerifyTokenWithExpiryTime(token string, secret string, currentTime int64) (int, int, error)
- type Action
- type Authorization
- type Authstruct
- func (as Authstruct) CheckPermissionIdExist(roleperm *[]TblRolePermission, roleid int, permissionid []int, DB *gorm.DB) error
- func (as Authstruct) CheckPermissionIdNotExist(roleperm *[]TblRolePermission, roleid int, permissionid []int, DB *gorm.DB) error
- func (as Authstruct) CheckRoleExists(role *TblRole, id int, name string, DB *gorm.DB) error
- func (as Authstruct) CreateModulePermission(modpermission *TblModulePermission, DB *gorm.DB) (modper *TblModulePermission, err error)
- func (as Authstruct) CreateRolePermission(roleper *[]TblRolePermission, DB *gorm.DB) error
- func (as Authstruct) CreateRolePermissionsingle(roleper *TblRolePermission, DB *gorm.DB) error
- func (as Authstruct) DeleteModulePermissioninEntries(tblmodper *TblModulePermission, id string, DB *gorm.DB) error
- func (as Authstruct) DeleteRolePermissionById(roleper *[]TblRolePermission, roleid int, DB *gorm.DB) error
- func (as Authstruct) Deleterolepermission(TblRolePermission *TblRolePermission, id int, DB *gorm.DB) error
- func (as Authstruct) GetAllModules(mod *[]TblModule, limit, offset, id int, filter Filter, DB *gorm.DB) (count int64)
- func (as Authstruct) GetAllParentModules1(mod *[]TblModule, DB *gorm.DB) (err error)
- func (as Authstruct) GetAllRoles(role *[]TblRole, limit, offset int, filter Filter, DB *gorm.DB) (rolecount int64, err error)
- func (as Authstruct) GetAllSubModules(mod *[]TblModule, ids []int, DB *gorm.DB) (err error)
- func (as Authstruct) GetIdByRouteName(tblmodper *TblModulePermission, id string, DB *gorm.DB) error
- func (as Authstruct) GetPermissionId(perm *[]TblRolePermission, roleid int, DB *gorm.DB) error
- func (as Authstruct) GetRoleById(role *TblRole, id int, DB *gorm.DB) error
- func (as Authstruct) GetRolesData(roles *[]TblRole, DB *gorm.DB) error
- func (as Authstruct) MultiSelectDeleteRolePermissionById(roleper *[]TblRolePermission, roleid []int, DB *gorm.DB) error
- func (as Authstruct) MultiSelectRoleDelete(role *TblRole, id []int, DB *gorm.DB) error
- func (as Authstruct) MultiSelectRoleIsActive(role *TblRole, id []int, val int, DB *gorm.DB) error
- func (as Authstruct) RoleCreate(role *TblRole, DB *gorm.DB) error
- func (as Authstruct) RoleDelete(role *TblRole, id int, DB *gorm.DB) error
- func (as Authstruct) RoleIsActive(role *TblRole, id, val int, DB *gorm.DB) error
- func (as Authstruct) RoleUpdate(role *TblRole, DB *gorm.DB) error
- func (as Authstruct) UpdateChannelNameInEntries(modper *TblModulePermission, DB *gorm.DB) error
- type Filter
- type LoginCheck
- type MultiPermissin
- type Option
- type Permission
- type PermissionAu
- func (a PermissionAu) CreatePermission(Perm MultiPermissin) error
- func (a PermissionAu) CreateUpdatePermission(Perm MultiPermissin) error
- func (a PermissionAu) GetPermissionDetailsById(roleid int) (rolepermissionid []int, err error)
- func (a PermissionAu) PermissionListRoleId(limit, offset, roleid int, filter Filter) (Module []TblModule, count int64, err error)
- type Role
- func (a Role) CheckRoleAlreadyExists(roleid int, rolename string) (bool, error)
- func (a Role) CreateRole(rolec RoleCreation) (TblRole, error)
- func (a Role) DeleteRole(roleid int) (bool, error)
- func (a Role) GetAllRoleData() (roles []TblRole, err error)
- func (a Role) GetRoleById(roleid int) (tblrole TblRole, err error)
- func (a Role) MultiSelectDeleteRole(roleid []int) (bool, error)
- func (a Role) MultiSelectRoleStatus(roleid []int, status int) (err error)
- func (a Role) RoleList(limit int, offset int, filter Filter) (roles []TblRole, rolecount int64, err error)
- func (a Role) RoleStatus(roleid int, status int) (err error)
- func (a Role) UpdateRole(rolec RoleCreation, roleid int) (role TblRole, err error)
- type RoleCreation
- type TblModule
- type TblModulePermission
- type TblRole
- type TblRolePermission
- type TblRoleUser
- type TblUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checklogin ¶
Check UserName Password
func CreateToken ¶
CreateToken creates a token with the given claims
func MigrationTable ¶
func VerifyToken ¶
verify token
Types ¶
type Authorization ¶
type Authstruct ¶
type Authstruct struct{}
var AS Authstruct
func (Authstruct) CheckPermissionIdExist ¶
func (as Authstruct) CheckPermissionIdExist(roleperm *[]TblRolePermission, roleid int, permissionid []int, DB *gorm.DB) error
func (Authstruct) CheckPermissionIdNotExist ¶
func (as Authstruct) CheckPermissionIdNotExist(roleperm *[]TblRolePermission, roleid int, permissionid []int, DB *gorm.DB) error
func (Authstruct) CheckRoleExists ¶
Check role
func (Authstruct) CreateModulePermission ¶
func (as Authstruct) CreateModulePermission(modpermission *TblModulePermission, DB *gorm.DB) (modper *TblModulePermission, err error)
create json module permission
func (Authstruct) CreateRolePermission ¶
func (as Authstruct) CreateRolePermission(roleper *[]TblRolePermission, DB *gorm.DB) error
bulk creation
func (Authstruct) CreateRolePermissionsingle ¶
func (as Authstruct) CreateRolePermissionsingle(roleper *TblRolePermission, DB *gorm.DB) error
single creation
func (Authstruct) DeleteModulePermissioninEntries ¶
func (as Authstruct) DeleteModulePermissioninEntries(tblmodper *TblModulePermission, id string, DB *gorm.DB) error
func (Authstruct) DeleteRolePermissionById ¶
func (as Authstruct) DeleteRolePermissionById(roleper *[]TblRolePermission, roleid int, DB *gorm.DB) error
func (Authstruct) Deleterolepermission ¶
func (as Authstruct) Deleterolepermission(TblRolePermission *TblRolePermission, id int, DB *gorm.DB) error
Delete Role Permission by id
func (Authstruct) GetAllModules ¶
func (as Authstruct) GetAllModules(mod *[]TblModule, limit, offset, id int, filter Filter, DB *gorm.DB) (count int64)
This is for assign permission
func (Authstruct) GetAllParentModules1 ¶
func (as Authstruct) GetAllParentModules1(mod *[]TblModule, DB *gorm.DB) (err error)
func (Authstruct) GetAllRoles ¶
func (as Authstruct) GetAllRoles(role *[]TblRole, limit, offset int, filter Filter, DB *gorm.DB) (rolecount int64, err error)
get all roles
func (Authstruct) GetAllSubModules ¶
func (Authstruct) GetIdByRouteName ¶
func (as Authstruct) GetIdByRouteName(tblmodper *TblModulePermission, id string, DB *gorm.DB) error
Get Id by RouteName
func (Authstruct) GetPermissionId ¶
func (as Authstruct) GetPermissionId(perm *[]TblRolePermission, roleid int, DB *gorm.DB) error
Get PermissionId By RoleId
func (Authstruct) GetRoleById ¶
Get role by id
func (Authstruct) GetRolesData ¶
func (as Authstruct) GetRolesData(roles *[]TblRole, DB *gorm.DB) error
func (Authstruct) MultiSelectDeleteRolePermissionById ¶ added in v1.0.73
func (as Authstruct) MultiSelectDeleteRolePermissionById(roleper *[]TblRolePermission, roleid []int, DB *gorm.DB) error
func (Authstruct) MultiSelectRoleDelete ¶ added in v1.0.73
func (Authstruct) MultiSelectRoleIsActive ¶ added in v1.0.73
func (Authstruct) RoleCreate ¶
func (as Authstruct) RoleCreate(role *TblRole, DB *gorm.DB) error
Roels Insert
func (Authstruct) RoleDelete ¶
Delete the role data
func (Authstruct) RoleIsActive ¶
update role isactive
func (Authstruct) RoleUpdate ¶
func (as Authstruct) RoleUpdate(role *TblRole, DB *gorm.DB) error
func (Authstruct) UpdateChannelNameInEntries ¶
func (as Authstruct) UpdateChannelNameInEntries(modper *TblModulePermission, DB *gorm.DB) error
update channel entry permission
type LoginCheck ¶
type MultiPermissin ¶
type Permission ¶
type PermissionAu ¶
type PermissionAu struct {
Auth Authorization
}
this struct holds dbconnection ,token
func (PermissionAu) CreatePermission ¶
func (a PermissionAu) CreatePermission(Perm MultiPermissin) error
create permission
func (PermissionAu) CreateUpdatePermission ¶
func (a PermissionAu) CreateUpdatePermission(Perm MultiPermissin) error
update permission
func (PermissionAu) GetPermissionDetailsById ¶
func (a PermissionAu) GetPermissionDetailsById(roleid int) (rolepermissionid []int, err error)
permission List
func (PermissionAu) PermissionListRoleId ¶
func (a PermissionAu) PermissionListRoleId(limit, offset, roleid int, filter Filter) (Module []TblModule, count int64, err error)
permission List
type Role ¶
type Role struct {
Auth Authorization
}
this struct holds dbconnection ,token
func (Role) CheckRoleAlreadyExists ¶
Check Role Already Exists
func (Role) GetAllRoleData ¶
func (Role) GetRoleById ¶
get role by id
func (Role) MultiSelectDeleteRole ¶ added in v1.0.73
func (Role) MultiSelectRoleStatus ¶ added in v1.0.73
func (Role) RoleList ¶
func (a Role) RoleList(limit int, offset int, filter Filter) (roles []TblRole, rolecount int64, err error)
create role
func (Role) RoleStatus ¶
change role status 0-inactive, 1-active
func (Role) UpdateRole ¶
func (a Role) UpdateRole(rolec RoleCreation, roleid int) (role TblRole, err error)
update role
type RoleCreation ¶
type TblModule ¶
type TblModule struct { Id int `gorm:"primaryKey;auto_increment"` ModuleName string IsActive int CreatedBy int CreatedOn time.Time CreatedDate string `gorm:"-:migration;<-:false"` DefaultModule int ParentId int IconPath string TblModulePermission []TblModulePermission `gorm:"-:migration;<-:false; foreignKey:ModuleId"` Description string OrderIndex int }
type TblModulePermission ¶
type TblModulePermission struct { Id int `gorm:"primaryKey;auto_increment"` RouteName string DisplayName string SlugName string Description string ModuleId int CreatedBy int CreatedOn time.Time CreatedDate string `gorm:"-"` ModifiedBy int `gorm:"DEFAULT:NULL"` ModifiedOn time.Time `gorm:"DEFAULT:NULL"` ModuleName string `gorm:"-:migration;<-:false"` FullAccessPermission int ParentId int AssignPermission int BreadcrumbName string TblRolePermission []TblRolePermission `gorm:"-:migration;<-:false; foreignKey:PermissionId"` OrderIndex int }
type TblRole ¶
type TblRole struct { Id int `gorm:"primaryKey;auto_increment"` Name string Description string Slug string IsActive int IsDeleted int CreatedOn time.Time CreatedBy int ModifiedOn time.Time `gorm:"DEFAULT:NULL"` ModifiedBy int `gorm:"DEFAULT:NULL"` CreatedDate string `gorm:"-:migration;<-:false"` User []TblUser `gorm:"-"` }
type TblRolePermission ¶
type TblRoleUser ¶
type TblRoleUser struct { Id int `gorm:"primaryKey;auto_increment"` RoleId int UserId int CreatedBy int CreatedOn time.Time ModifiedBy int `gorm:"DEFAULT:NULL"` ModifiedOn time.Time `gorm:"DEFAULT:NULL"` ModuleName string `gorm:"-"` RouteName string `gorm:"-:migration;<-:false"` DisplayName string `gorm:"-:migration;<-"` Description string `gorm:"-"` ModuleId int `gorm:"-:migration;<-"` PermissionId int `gorm:"-"` }
type TblUser ¶
type TblUser struct { Id int `gorm:"primaryKey;auto_increment"` Uuid string FirstName string LastName string RoleId int Email string Username string Password string MobileNo string IsActive int ProfileImage string ProfileImagePath string DataAccess int CreatedOn time.Time CreatedBy int ModifiedOn time.Time `gorm:"DEFAULT:NULL"` ModifiedBy int `gorm:"DEFAULT:NULL"` LastLogin time.Time `gorm:"DEFAULT:NULL"` IsDeleted int DeletedOn time.Time `gorm:"DEFAULT:NULL"` DeletedBy int `gorm:"DEFAULT:NULL"` ModuleName string `gorm:"-"` RouteName string `gorm:"-:migration;<-:false"` DisplayName string `gorm:"-:migration;<-:false"` Description string `gorm:"-"` ModuleId int `gorm:"-:migration;<-:false"` PermissionId int `gorm:"-"` FullAccessPermission int `gorm:"-:migration;<-:false"` Roles []TblRole `gorm:"-"` }
Click to show internal directories.
Click to hide internal directories.