repository

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

@description: user crud

@description: user authentication and authorization

@description: user crud

Index

Constants

View Source
const (
	EMPTY_PLACEHOLDER_FOR_QUERY = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterRolePolicyDetails

type ClusterRolePolicyDetails struct {
	Entity       string
	Cluster      string
	Namespace    string
	Group        string
	Kind         string
	Resource     string
	ClusterObj   string
	NamespaceObj string
	GroupObj     string
	KindObj      string
	ResourceObj  string
}

type DefaultAuthPolicy

type DefaultAuthPolicy struct {
	TableName struct{} `sql:"default_auth_policy" pg:",discard_unknown_columns"`
	Id        int      `sql:"id,pk"`
	RoleType  string   `sql:"role_type,notnull"`
	Policy    string   `sql:"policy,notnull"`

	sql.AuditLog
	// contains filtered or unexported fields
}

type DefaultAuthPolicyRepository

type DefaultAuthPolicyRepository interface {
	CreatePolicy(policy *DefaultAuthPolicy) (*DefaultAuthPolicy, error)
	UpdatePolicyByRoleType(policy string, roleType bean.RoleType) (*DefaultAuthPolicy, error)
	GetPolicyByRoleTypeAndEntity(roleType bean.RoleType, accessType string, entity string) (policy string, err error)
}

type DefaultAuthPolicyRepositoryImpl

type DefaultAuthPolicyRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewDefaultAuthPolicyRepositoryImpl

func NewDefaultAuthPolicyRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *DefaultAuthPolicyRepositoryImpl

func (DefaultAuthPolicyRepositoryImpl) CreatePolicy

func (DefaultAuthPolicyRepositoryImpl) GetPolicyByRoleTypeAndEntity

func (impl DefaultAuthPolicyRepositoryImpl) GetPolicyByRoleTypeAndEntity(roleType bean.RoleType, accessType string, entity string) (policy string, err error)

func (DefaultAuthPolicyRepositoryImpl) UpdatePolicyByRoleType

func (impl DefaultAuthPolicyRepositoryImpl) UpdatePolicyByRoleType(policy string, roleType bean.RoleType) (*DefaultAuthPolicy, error)

type DefaultAuthRole

type DefaultAuthRole struct {
	TableName struct{} `sql:"default_auth_role" pg:",discard_unknown_columns"`
	Id        int      `sql:"id,pk"`
	RoleType  string   `sql:"role_type,notnull"`
	Role      string   `sql:"role,notnull"`

	sql.AuditLog
	// contains filtered or unexported fields
}

type DefaultAuthRoleRepository

type DefaultAuthRoleRepository interface {
	CreateRole(role *DefaultAuthRole) (*DefaultAuthRole, error)
	UpdateRole(role *DefaultAuthRole) (*DefaultAuthRole, error)
	GetRoleByRoleTypeAndEntityType(roleType bean.RoleType, accessType string, entity string) (role string, err error)
}

type DefaultAuthRoleRepositoryImpl

type DefaultAuthRoleRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewDefaultAuthRoleRepositoryImpl

func NewDefaultAuthRoleRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *DefaultAuthRoleRepositoryImpl

func (DefaultAuthRoleRepositoryImpl) CreateRole

func (DefaultAuthRoleRepositoryImpl) GetRoleByRoleTypeAndEntityType

func (impl DefaultAuthRoleRepositoryImpl) GetRoleByRoleTypeAndEntityType(roleType bean.RoleType, accessType string, entity string) (role string, err error)

func (DefaultAuthRoleRepositoryImpl) UpdateRole

type PValDetailObj

type PValDetailObj struct {
	Value       string                `json:"value"`
	IndexKeyMap map[int]PValUpdateKey `json:"indexKeyMap"` //map of index at which replacement is to be done and name of key that is to for updating value
}

type PValUpdateKey

type PValUpdateKey string
const (
	EntityPValUpdateKey       PValUpdateKey = "Entity"
	EntityNamePValUpdateKey   PValUpdateKey = "EntityName"
	AppPValUpdateKey          PValUpdateKey = "App"
	EnvPValUpdateKey          PValUpdateKey = "Env"
	TeamPValUpdateKey         PValUpdateKey = "Team"
	ClusterPValUpdateKey      PValUpdateKey = "Cluster"
	NamespacePValUpdateKey    PValUpdateKey = "Namespace"
	GroupPValUpdateKey        PValUpdateKey = "Group"
	KindPValUpdateKey         PValUpdateKey = "Kind"
	ResourcePValUpdateKey     PValUpdateKey = "Resource"
	AppObjPValUpdateKey       PValUpdateKey = "AppObj"
	EnvObjPValUpdateKey       PValUpdateKey = "EnvObj"
	TeamObjPValUpdateKey      PValUpdateKey = "TeamObj"
	ClusterObjPValUpdateKey   PValUpdateKey = "ClusterObj"
	NamespaceObjPValUpdateKey PValUpdateKey = "NamespaceObj"
	GroupObjPValUpdateKey     PValUpdateKey = "GroupObj"
	KindObjPValUpdateKey      PValUpdateKey = "KindObj"
	ResourceObjPValUpdateKey  PValUpdateKey = "ResourceObj"
	WorkflowPValUpdateKey     PValUpdateKey = "Workflow"
	WorkflowObjPValUpdateKey  PValUpdateKey = "WorkflowObj"
)

type PolicyCacheDetailObj

type PolicyCacheDetailObj struct {
	Type         PValDetailObj `json:"type"`
	Sub          PValDetailObj `json:"sub"`
	ResActObjSet []ResActObj   `json:"resActObjSet"`
}

type RbacDataCacheFactory

type RbacDataCacheFactory interface {
	GetDefaultRoleDataAndPolicyByEntityAccessTypeAndRoleType(entity, accessType, roleType string) (RoleCacheDetailObj, PolicyCacheDetailObj, error)
	SyncPolicyCache()
	SyncRoleDataCache()
}

type RbacDataCacheFactoryImpl

type RbacDataCacheFactoryImpl struct {
	// contains filtered or unexported fields
}

func NewRbacDataCacheFactoryImpl

func NewRbacDataCacheFactoryImpl(logger *zap.SugaredLogger,
	defaultRbacPolicyDataRepository RbacPolicyDataRepository,
	defaultRbacRoleDataRepository RbacRoleDataRepository) *RbacDataCacheFactoryImpl

func (*RbacDataCacheFactoryImpl) GetDefaultRoleDataAndPolicyByEntityAccessTypeAndRoleType

func (impl *RbacDataCacheFactoryImpl) GetDefaultRoleDataAndPolicyByEntityAccessTypeAndRoleType(entity, accessType, roleType string) (RoleCacheDetailObj, PolicyCacheDetailObj, error)

func (*RbacDataCacheFactoryImpl) SyncPolicyCache

func (impl *RbacDataCacheFactoryImpl) SyncPolicyCache()

func (*RbacDataCacheFactoryImpl) SyncRoleDataCache

func (impl *RbacDataCacheFactoryImpl) SyncRoleDataCache()

type RbacPolicyData

type RbacPolicyData struct {
	TableName    struct{} `sql:"rbac_policy_data" pg:",discard_unknown_columns"`
	Id           int      `sql:"id"`
	Entity       string   `sql:"entity"`
	AccessType   string   `sql:"access_type"`
	Role         string   `sql:"role"`
	PolicyData   string   `sql:"policy_data"`
	IsPresetRole bool     `sql:"is_preset_role,notnull"`
	Deleted      bool     `sql:"deleted,notnull"`
	sql.AuditLog
}

type RbacPolicyDataRepository

type RbacPolicyDataRepository interface {
	GetPolicyDataForAllRoles() ([]*RbacPolicyData, error)
	CreateNewPolicyDataForRoleWithTxn(model *RbacPolicyData, tx *pg.Tx) (*RbacPolicyData, error)
	UpdatePolicyDataForRoleWithTxn(model *RbacPolicyData, tx *pg.Tx) (*RbacPolicyData, error)
}

type RbacPolicyDataRepositoryImpl

type RbacPolicyDataRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewRbacPolicyDataRepositoryImpl

func NewRbacPolicyDataRepositoryImpl(logger *zap.SugaredLogger,
	dbConnection *pg.DB) *RbacPolicyDataRepositoryImpl

func (*RbacPolicyDataRepositoryImpl) CreateNewPolicyDataForRoleWithTxn

func (repo *RbacPolicyDataRepositoryImpl) CreateNewPolicyDataForRoleWithTxn(model *RbacPolicyData, tx *pg.Tx) (*RbacPolicyData, error)

func (*RbacPolicyDataRepositoryImpl) GetPolicyDataForAllRoles

func (repo *RbacPolicyDataRepositoryImpl) GetPolicyDataForAllRoles() ([]*RbacPolicyData, error)

func (*RbacPolicyDataRepositoryImpl) UpdatePolicyDataForRoleWithTxn

func (repo *RbacPolicyDataRepositoryImpl) UpdatePolicyDataForRoleWithTxn(model *RbacPolicyData, tx *pg.Tx) (*RbacPolicyData, error)

type RbacRoleData

type RbacRoleData struct {
	TableName       struct{} `sql:"rbac_role_data" pg:",discard_unknown_columns"`
	Id              int      `sql:"id"`
	Entity          string   `sql:"entity"`
	AccessType      string   `sql:"access_type"`
	Role            string   `sql:"role"`
	RoleData        string   `sql:"role_data"`
	RoleDisplayName string   `sql:"role_display_name"`
	RoleDescription string   `sql:"role_description"`
	IsPresetRole    bool     `sql:"is_preset_role,notnull"`
	Deleted         bool     `sql:"deleted,notnull"`
	sql.AuditLog
}

type RbacRoleDataRepository

type RbacRoleDataRepository interface {
	GetRoleDataForAllRoles() ([]*RbacRoleData, error)
	CreateNewRoleDataForRoleWithTxn(model *RbacRoleData, tx *pg.Tx) (*RbacRoleData, error)
	UpdateRoleDataForRoleWithTxn(model *RbacRoleData, tx *pg.Tx) (*RbacRoleData, error)
}

type RbacRoleDataRepositoryImpl

type RbacRoleDataRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewRbacRoleDataRepositoryImpl

func NewRbacRoleDataRepositoryImpl(logger *zap.SugaredLogger,
	dbConnection *pg.DB) *RbacRoleDataRepositoryImpl

func (*RbacRoleDataRepositoryImpl) CreateNewRoleDataForRoleWithTxn

func (repo *RbacRoleDataRepositoryImpl) CreateNewRoleDataForRoleWithTxn(model *RbacRoleData, tx *pg.Tx) (*RbacRoleData, error)

func (*RbacRoleDataRepositoryImpl) GetRoleDataForAllRoles

func (repo *RbacRoleDataRepositoryImpl) GetRoleDataForAllRoles() ([]*RbacRoleData, error)

func (*RbacRoleDataRepositoryImpl) UpdateRoleDataForRoleWithTxn

func (repo *RbacRoleDataRepositoryImpl) UpdateRoleDataForRoleWithTxn(model *RbacRoleData, tx *pg.Tx) (*RbacRoleData, error)

type ResActObj

type ResActObj struct {
	Res PValDetailObj `json:"res"`
	Act PValDetailObj `json:"act"`
	Obj PValDetailObj `json:"obj"`
}

type RoleCacheDetailObj

type RoleCacheDetailObj struct {
	Role        PValDetailObj `json:"role"`
	Entity      PValDetailObj `json:"entity"`
	Team        PValDetailObj `json:"team"`
	EntityName  PValDetailObj `json:"entityName"`
	Environment PValDetailObj `json:"environment"`
	Action      PValDetailObj `json:"action"`
	AccessType  PValDetailObj `json:"accessType"`
	Cluster     PValDetailObj `json:"cluster"`
	Namespace   PValDetailObj `json:"namespace"`
	Group       PValDetailObj `json:"group"`
	Kind        PValDetailObj `json:"kind"`
	Resource    PValDetailObj `json:"resource"`
	Workflow    PValDetailObj `json:"workflow"`
}

type RoleGroup

type RoleGroup struct {
	TableName   struct{} `sql:"role_group" pg:",discard_unknown_columns"`
	Id          int32    `sql:"id,pk"`
	Name        string   `sql:"name,notnull"`
	CasbinName  string   `sql:"casbin_name,notnull"`
	Description string   `sql:"description"`
	Active      bool     `sql:"active,notnull"`
	sql.AuditLog
}

type RoleGroupRepository

type RoleGroupRepository interface {
	StartATransaction() (*pg.Tx, error)
	CommitATransaction(tx *pg.Tx) error
	CreateRoleGroup(model *RoleGroup, tx *pg.Tx) (*RoleGroup, error)
	UpdateRoleGroup(model *RoleGroup, tx *pg.Tx) (*RoleGroup, error)
	UpdateToInactiveByIds(ids []int32, tx *pg.Tx, loggedInUserId int32) error
	GetRoleGroupById(id int32) (*RoleGroup, error)
	GetRoleGroupByName(name string) (*RoleGroup, error)
	GetRoleGroupListByName(name string) ([]*RoleGroup, error)
	GetAllRoleGroup() ([]*RoleGroup, error)
	GetAllExecutingQuery(query string) ([]*RoleGroup, error)
	GetRoleGroupListByCasbinNames(name []string) ([]*RoleGroup, error)
	CheckRoleGroupExistByCasbinName(name string) (bool, error)
	CreateRoleGroupRoleMapping(model *RoleGroupRoleMapping, tx *pg.Tx) (*RoleGroupRoleMapping, error)
	GetRoleGroupRoleMapping(model int32) (*RoleGroupRoleMapping, error)
	GetRoleGroupRoleMappingByRoleGroupId(roleGroupId int32) ([]*RoleGroupRoleMapping, error)
	GetRoleGroupRoleMappingIdsByRoleGroupId(roleGroupId int32) ([]int, error)
	DeleteRoleGroupRoleMappingByRoleId(roleId int, tx *pg.Tx) error
	DeleteRoleGroupRoleMappingByRoleIds(roleId []int, tx *pg.Tx) error
	DeleteRoleGroupRoleMapping(model *RoleGroupRoleMapping, tx *pg.Tx) (bool, error)
	GetConnection() (dbConnection *pg.DB)
	GetRoleGroupListByNames(groupNames []string) ([]*RoleGroup, error)
	GetRolesByRoleGroupIds(roleGroupIds []int32) ([]*RoleModel, error)
	GetRolesByGroupCasbinName(groupName string) ([]*RoleModel, error)
	GetRolesByGroupCasbinNames(groupCasbinNames []string) ([]*RoleModel, error)
	GetRolesByGroupNames(groupNames []string) ([]*RoleModel, error)
	GetRolesByGroupNamesAndEntity(groupNames []string, entity string) ([]*RoleModel, error)
	UpdateRoleGroupIdForRoleGroupMappings(roleId int, newRoleId int) (*RoleGroupRoleMapping, error)
	GetCasbinNamesById(ids []int32) ([]string, error)
	GetRoleGroupRoleMappingIdsByGroupIds(groupIds []int32) ([]int, error)
	DeleteRoleGroupRoleMappingByIds(ids []int, tx *pg.Tx) error
}

type RoleGroupRepositoryImpl

type RoleGroupRepositoryImpl struct {
	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewRoleGroupRepositoryImpl

func NewRoleGroupRepositoryImpl(dbConnection *pg.DB, Logger *zap.SugaredLogger) *RoleGroupRepositoryImpl

func (RoleGroupRepositoryImpl) CheckRoleGroupExistByCasbinName

func (impl RoleGroupRepositoryImpl) CheckRoleGroupExistByCasbinName(name string) (bool, error)

func (RoleGroupRepositoryImpl) CommitATransaction added in v0.6.29

func (impl RoleGroupRepositoryImpl) CommitATransaction(tx *pg.Tx) error

func (RoleGroupRepositoryImpl) CreateRoleGroup

func (impl RoleGroupRepositoryImpl) CreateRoleGroup(model *RoleGroup, tx *pg.Tx) (*RoleGroup, error)

func (RoleGroupRepositoryImpl) CreateRoleGroupRoleMapping

func (impl RoleGroupRepositoryImpl) CreateRoleGroupRoleMapping(model *RoleGroupRoleMapping, tx *pg.Tx) (*RoleGroupRoleMapping, error)

func (RoleGroupRepositoryImpl) DeleteRoleGroupRoleMapping

func (impl RoleGroupRepositoryImpl) DeleteRoleGroupRoleMapping(model *RoleGroupRoleMapping, tx *pg.Tx) (bool, error)

func (RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByIds added in v0.6.29

func (impl RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByIds(ids []int, tx *pg.Tx) error

func (RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByRoleId

func (impl RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByRoleId(roleId int, tx *pg.Tx) error

func (RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByRoleIds

func (impl RoleGroupRepositoryImpl) DeleteRoleGroupRoleMappingByRoleIds(roleIds []int, tx *pg.Tx) error

func (RoleGroupRepositoryImpl) GetAllExecutingQuery added in v0.6.29

func (impl RoleGroupRepositoryImpl) GetAllExecutingQuery(query string) ([]*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetAllRoleGroup

func (impl RoleGroupRepositoryImpl) GetAllRoleGroup() ([]*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetCasbinNamesById added in v0.6.29

func (impl RoleGroupRepositoryImpl) GetCasbinNamesById(ids []int32) ([]string, error)

func (*RoleGroupRepositoryImpl) GetConnection

func (impl *RoleGroupRepositoryImpl) GetConnection() (dbConnection *pg.DB)

func (RoleGroupRepositoryImpl) GetRoleGroupById

func (impl RoleGroupRepositoryImpl) GetRoleGroupById(id int32) (*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetRoleGroupByName

func (impl RoleGroupRepositoryImpl) GetRoleGroupByName(name string) (*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetRoleGroupListByCasbinNames

func (impl RoleGroupRepositoryImpl) GetRoleGroupListByCasbinNames(names []string) ([]*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetRoleGroupListByName

func (impl RoleGroupRepositoryImpl) GetRoleGroupListByName(name string) ([]*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetRoleGroupListByNames

func (impl RoleGroupRepositoryImpl) GetRoleGroupListByNames(groupNames []string) ([]*RoleGroup, error)

func (RoleGroupRepositoryImpl) GetRoleGroupRoleMapping

func (impl RoleGroupRepositoryImpl) GetRoleGroupRoleMapping(userRoleModelId int32) (*RoleGroupRoleMapping, error)

func (RoleGroupRepositoryImpl) GetRoleGroupRoleMappingByRoleGroupId

func (impl RoleGroupRepositoryImpl) GetRoleGroupRoleMappingByRoleGroupId(roleGroupId int32) ([]*RoleGroupRoleMapping, error)

func (RoleGroupRepositoryImpl) GetRoleGroupRoleMappingIdsByGroupIds added in v0.6.29

func (impl RoleGroupRepositoryImpl) GetRoleGroupRoleMappingIdsByGroupIds(groupIds []int32) ([]int, error)

func (RoleGroupRepositoryImpl) GetRoleGroupRoleMappingIdsByRoleGroupId added in v0.6.29

func (impl RoleGroupRepositoryImpl) GetRoleGroupRoleMappingIdsByRoleGroupId(roleGroupId int32) ([]int, error)

func (RoleGroupRepositoryImpl) GetRolesByGroupCasbinName

func (impl RoleGroupRepositoryImpl) GetRolesByGroupCasbinName(groupName string) ([]*RoleModel, error)

func (RoleGroupRepositoryImpl) GetRolesByGroupCasbinNames

func (impl RoleGroupRepositoryImpl) GetRolesByGroupCasbinNames(groupCasbinNames []string) ([]*RoleModel, error)

func (RoleGroupRepositoryImpl) GetRolesByGroupNames

func (impl RoleGroupRepositoryImpl) GetRolesByGroupNames(groupNames []string) ([]*RoleModel, error)

func (RoleGroupRepositoryImpl) GetRolesByGroupNamesAndEntity

func (impl RoleGroupRepositoryImpl) GetRolesByGroupNamesAndEntity(groupNames []string, entity string) ([]*RoleModel, error)

func (RoleGroupRepositoryImpl) GetRolesByRoleGroupIds added in v0.6.29

func (impl RoleGroupRepositoryImpl) GetRolesByRoleGroupIds(roleGroupIds []int32) ([]*RoleModel, error)

func (RoleGroupRepositoryImpl) StartATransaction added in v0.6.29

func (impl RoleGroupRepositoryImpl) StartATransaction() (*pg.Tx, error)

func (RoleGroupRepositoryImpl) UpdateRoleGroup

func (impl RoleGroupRepositoryImpl) UpdateRoleGroup(model *RoleGroup, tx *pg.Tx) (*RoleGroup, error)

func (RoleGroupRepositoryImpl) UpdateRoleGroupIdForRoleGroupMappings

func (impl RoleGroupRepositoryImpl) UpdateRoleGroupIdForRoleGroupMappings(roleId int, newRoleId int) (*RoleGroupRoleMapping, error)

func (RoleGroupRepositoryImpl) UpdateToInactiveByIds added in v0.6.29

func (impl RoleGroupRepositoryImpl) UpdateToInactiveByIds(ids []int32, tx *pg.Tx, loggedInUserId int32) error

type RoleGroupRoleMapping

type RoleGroupRoleMapping struct {
	TableName   struct{} `sql:"role_group_role_mapping"  pg:",discard_unknown_columns"`
	Id          int      `sql:"id,pk"`
	RoleGroupId int32    `sql:"role_group_id,notnull"`
	RoleId      int      `sql:"role_id,notnull"`
	sql.AuditLog
}

type RoleModel

type RoleModel struct {
	TableName   struct{} `sql:"roles" pg:",discard_unknown_columns"`
	Id          int      `sql:"id,pk"`
	Role        string   `sql:"role,notnull"`
	Entity      string   `sql:"entity"`
	Team        string   `sql:"team"`
	EntityName  string   `sql:"entity_name"`
	Environment string   `sql:"environment"`
	Action      string   `sql:"action"`
	AccessType  string   `sql:"access_type"`
	Cluster     string   `sql:"cluster"`
	Namespace   string   `sql:"namespace"`
	Group       string   `sql:"group"`
	Kind        string   `sql:"kind"`
	Resource    string   `sql:"resource"`
	Workflow    string   `sql:"workflow"`
	sql.AuditLog
}

type RolePolicyDetails

type RolePolicyDetails struct {
	Team       string
	Env        string
	App        string
	TeamObj    string
	EnvObj     string
	AppObj     string
	Entity     string
	EntityName string

	Cluster      string
	Namespace    string
	Group        string
	Kind         string
	Resource     string
	ClusterObj   string
	NamespaceObj string
	GroupObj     string
	KindObj      string
	ResourceObj  string
	Approver     bool
}

type SelfRegistrationRoles

type SelfRegistrationRoles struct {
	TableName struct{} `sql:"self_registration_roles" pg:",discard_unknown_columns"`
	Role      string   `sql:"role,notnull"`
	sql.AuditLog
}

type SelfRegistrationRolesRepository

type SelfRegistrationRolesRepository interface {
	GetAll() ([]SelfRegistrationRoles, error)
}

type SelfRegistrationRolesRepositoryImpl

type SelfRegistrationRolesRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewSelfRegistrationRolesRepositoryImpl

func NewSelfRegistrationRolesRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *SelfRegistrationRolesRepositoryImpl

func (*SelfRegistrationRolesRepositoryImpl) GetAll

type UserAudit

type UserAudit struct {
	TableName struct{}  `sql:"user_audit"`
	Id        int32     `sql:"id,pk"`
	UserId    int32     `sql:"user_id, notnull"`
	ClientIp  string    `sql:"client_ip"`
	CreatedOn time.Time `sql:"created_on,type:timestamptz"`
	UpdatedOn time.Time `sql:"updated_on,type:timestamptz"`
}

type UserAuditRepository

type UserAuditRepository interface {
	Save(userAudit *UserAudit) error
	GetLatestByUserId(userId int32) (*UserAudit, error)
	GetLatestUser() (*UserAudit, error)
	Update(userAudit *UserAudit) error
}

type UserAuditRepositoryImpl

type UserAuditRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewUserAuditRepositoryImpl

func NewUserAuditRepositoryImpl(dbConnection *pg.DB) *UserAuditRepositoryImpl

func (UserAuditRepositoryImpl) GetLatestByUserId

func (impl UserAuditRepositoryImpl) GetLatestByUserId(userId int32) (*UserAudit, error)

func (UserAuditRepositoryImpl) GetLatestUser

func (impl UserAuditRepositoryImpl) GetLatestUser() (*UserAudit, error)

func (UserAuditRepositoryImpl) Save

func (impl UserAuditRepositoryImpl) Save(userAudit *UserAudit) error

func (UserAuditRepositoryImpl) Update

func (impl UserAuditRepositoryImpl) Update(userAudit *UserAudit) error

type UserAuthRepository

type UserAuthRepository interface {
	CreateRole(role *RoleModel) (*RoleModel, error)
	CreateRoleWithTxn(userModel *RoleModel, tx *pg.Tx) (*RoleModel, error)
	GetRoleById(id int) (*RoleModel, error)
	GetRolesByIds(ids []int) ([]RoleModel, error)
	GetRoleByRoles(roles []string) ([]RoleModel, error)
	GetRolesByUserId(userId int32) ([]RoleModel, error)
	GetRolesByGroupId(userId int32) ([]*RoleModel, error)
	GetAllRole() ([]RoleModel, error)
	GetRolesByActionAndAccessType(action string, accessType string) ([]RoleModel, error)
	GetRoleByFilterForAllTypes(entity, team, app, env, act, accessType, cluster, namespace, group, kind, resource, action string, oldValues bool, workflow string) (RoleModel, error)
	CreateUserRoleMapping(userRoleModel *UserRoleModel, tx *pg.Tx) (*UserRoleModel, error)
	GetUserRoleMappingByUserId(userId int32) ([]*UserRoleModel, error)
	GetUserRoleMappingIdsByUserId(userId int32) ([]int, error)
	GetUserRoleMappingIdsByUserIds(userIds []int32) ([]int, error)
	DeleteUserRoleMapping(userRoleModel *UserRoleModel, tx *pg.Tx) (bool, error)
	DeleteUserRoleMappingByIds(urmIds []int, tx *pg.Tx) error
	DeleteUserRoleByRoleId(roleId int, tx *pg.Tx) error
	DeleteUserRoleByRoleIds(roleIds []int, tx *pg.Tx) error
	CreateDefaultPoliciesForAllTypes(team, entityName, env, entity, cluster, namespace, group, kind, resource, actionType, accessType string, UserId int32) (bool, error, []casbin2.Policy)
	CreateRoleForSuperAdminIfNotExists(tx *pg.Tx, UserId int32) (bool, error)
	SyncOrchestratorToCasbin(team string, entityName string, env string, tx *pg.Tx) (bool, error)
	UpdateTriggerPolicyForTerminalAccess() error
	GetRolesForEnvironment(envName, envIdentifier string) ([]*RoleModel, error)
	GetRolesForProject(teamName string) ([]*RoleModel, error)
	GetRolesForApp(appName string) ([]*RoleModel, error)
	GetRolesForChartGroup(chartGroupName string) ([]*RoleModel, error)
	DeleteRole(role *RoleModel, tx *pg.Tx) error
	DeleteRolesByIds(roleIds []int, tx *pg.Tx) error
	//GetRoleByFilterForClusterEntity(cluster, namespace, group, kind, resource, action string) (RoleModel, error)
	GetRolesByUserIdAndEntityType(userId int32, entityType string) ([]*RoleModel, error)
	CreateRolesWithAccessTypeAndEntity(team, entityName, env, entity, cluster, namespace, group, kind, resource, actionType, accessType string, UserId int32, role string) (bool, error)
	GetRolesForWorkflow(workflow, entityName string) ([]*RoleModel, error)
	GetRoleForClusterEntity(cluster, namespace, group, kind, resource, action string) (RoleModel, error)
	GetRoleForJobsEntity(entity, team, app, env, act string, workflow string) (RoleModel, error)
	GetRoleForOtherEntity(team, app, env, act, accessType string, oldValues bool) (RoleModel, error)
	GetRoleForChartGroupEntity(entity, app, act, accessType string) (RoleModel, error)
}

type UserAuthRepositoryImpl

type UserAuthRepositoryImpl struct {
	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewUserAuthRepositoryImpl

func NewUserAuthRepositoryImpl(dbConnection *pg.DB, Logger *zap.SugaredLogger,
	defaultAuthPolicyRepository DefaultAuthPolicyRepository,
	defaultAuthRoleRepository DefaultAuthRoleRepository) *UserAuthRepositoryImpl

func (UserAuthRepositoryImpl) CreateDefaultPoliciesForAllTypes

func (impl UserAuthRepositoryImpl) CreateDefaultPoliciesForAllTypes(team, entityName, env, entity, cluster, namespace, group, kind, resource, actionType, accessType string, UserId int32) (bool, error, []casbin2.Policy)

func (UserAuthRepositoryImpl) CreateRole

func (impl UserAuthRepositoryImpl) CreateRole(role *RoleModel) (*RoleModel, error)

func (UserAuthRepositoryImpl) CreateRoleForSuperAdminIfNotExists

func (impl UserAuthRepositoryImpl) CreateRoleForSuperAdminIfNotExists(tx *pg.Tx, UserId int32) (bool, error)

func (UserAuthRepositoryImpl) CreateRoleWithTxn

func (impl UserAuthRepositoryImpl) CreateRoleWithTxn(userModel *RoleModel, tx *pg.Tx) (*RoleModel, error)

func (UserAuthRepositoryImpl) CreateRolesWithAccessTypeAndEntity

func (impl UserAuthRepositoryImpl) CreateRolesWithAccessTypeAndEntity(team, entityName, env, entity, cluster, namespace, group, kind, resource, actionType, accessType string, UserId int32, role string) (bool, error)

func (UserAuthRepositoryImpl) CreateUserRoleMapping

func (impl UserAuthRepositoryImpl) CreateUserRoleMapping(userRoleModel *UserRoleModel, tx *pg.Tx) (*UserRoleModel, error)

func (UserAuthRepositoryImpl) DeleteRole

func (impl UserAuthRepositoryImpl) DeleteRole(role *RoleModel, tx *pg.Tx) error

func (UserAuthRepositoryImpl) DeleteRolesByIds

func (impl UserAuthRepositoryImpl) DeleteRolesByIds(roleIds []int, tx *pg.Tx) error

func (UserAuthRepositoryImpl) DeleteUserRoleByRoleId

func (impl UserAuthRepositoryImpl) DeleteUserRoleByRoleId(roleId int, tx *pg.Tx) error

func (UserAuthRepositoryImpl) DeleteUserRoleByRoleIds

func (impl UserAuthRepositoryImpl) DeleteUserRoleByRoleIds(roleIds []int, tx *pg.Tx) error

func (UserAuthRepositoryImpl) DeleteUserRoleMapping

func (impl UserAuthRepositoryImpl) DeleteUserRoleMapping(userRoleModel *UserRoleModel, tx *pg.Tx) (bool, error)

func (UserAuthRepositoryImpl) DeleteUserRoleMappingByIds added in v0.6.29

func (impl UserAuthRepositoryImpl) DeleteUserRoleMappingByIds(urmIds []int, tx *pg.Tx) error

func (UserAuthRepositoryImpl) GetAllRole

func (impl UserAuthRepositoryImpl) GetAllRole() ([]RoleModel, error)

func (UserAuthRepositoryImpl) GetDefaultPolicyByRoleType

func (impl UserAuthRepositoryImpl) GetDefaultPolicyByRoleType(roleType bean2.RoleType) (policy string, err error)

func (UserAuthRepositoryImpl) GetDiffBetweenPolicies

func (impl UserAuthRepositoryImpl) GetDiffBetweenPolicies(oldPolicy string, newPolicy string) (addedPolicies []casbin2.Policy, deletedPolicies []casbin2.Policy, err error)

func (UserAuthRepositoryImpl) GetRole

func (impl UserAuthRepositoryImpl) GetRole(role string) (*RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleByFilterForAllTypes

func (impl UserAuthRepositoryImpl) GetRoleByFilterForAllTypes(entity, team, app, env, act, accessType, cluster, namespace, group, kind, resource, action string, oldValues bool, workflow string) (RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleById

func (impl UserAuthRepositoryImpl) GetRoleById(id int) (*RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleByRoles

func (impl UserAuthRepositoryImpl) GetRoleByRoles(roles []string) ([]RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleForChartGroupEntity

func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act, accessType string) (RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleForClusterEntity

func (impl UserAuthRepositoryImpl) GetRoleForClusterEntity(cluster, namespace, group, kind, resource, action string) (RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleForJobsEntity

func (impl UserAuthRepositoryImpl) GetRoleForJobsEntity(entity, team, app, env, act string, workflow string) (RoleModel, error)

func (UserAuthRepositoryImpl) GetRoleForOtherEntity

func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, accessType string, oldValues bool) (RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesByActionAndAccessType

func (impl UserAuthRepositoryImpl) GetRolesByActionAndAccessType(action string, accessType string) ([]RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesByGroupId

func (impl UserAuthRepositoryImpl) GetRolesByGroupId(roleGroupId int32) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesByIds

func (impl UserAuthRepositoryImpl) GetRolesByIds(ids []int) ([]RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesByUserId

func (impl UserAuthRepositoryImpl) GetRolesByUserId(userId int32) ([]RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesByUserIdAndEntityType

func (impl UserAuthRepositoryImpl) GetRolesByUserIdAndEntityType(userId int32, entityType string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesForApp

func (impl UserAuthRepositoryImpl) GetRolesForApp(appName string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesForChartGroup

func (impl UserAuthRepositoryImpl) GetRolesForChartGroup(chartGroupName string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesForEnvironment

func (impl UserAuthRepositoryImpl) GetRolesForEnvironment(envName, envIdentifier string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesForProject

func (impl UserAuthRepositoryImpl) GetRolesForProject(teamName string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetRolesForWorkflow

func (impl UserAuthRepositoryImpl) GetRolesForWorkflow(workflow, entityName string) ([]*RoleModel, error)

func (UserAuthRepositoryImpl) GetUpdatedAddedOrDeletedPolicies

func (impl UserAuthRepositoryImpl) GetUpdatedAddedOrDeletedPolicies(policies []casbin2.Policy, rolePolicyDetails RolePolicyDetails) (bean.PolicyRequest, error)

func (UserAuthRepositoryImpl) GetUserRoleMappingByUserId

func (impl UserAuthRepositoryImpl) GetUserRoleMappingByUserId(userId int32) ([]*UserRoleModel, error)

func (UserAuthRepositoryImpl) GetUserRoleMappingIdsByUserId added in v0.6.29

func (impl UserAuthRepositoryImpl) GetUserRoleMappingIdsByUserId(userId int32) ([]int, error)

func (UserAuthRepositoryImpl) GetUserRoleMappingIdsByUserIds added in v0.6.29

func (impl UserAuthRepositoryImpl) GetUserRoleMappingIdsByUserIds(userIds []int32) ([]int, error)

func (UserAuthRepositoryImpl) SyncOrchestratorToCasbin

func (impl UserAuthRepositoryImpl) SyncOrchestratorToCasbin(team string, entityName string, env string, tx *pg.Tx) (bool, error)

func (UserAuthRepositoryImpl) UpdateDefaultPolicyByRoleType

func (impl UserAuthRepositoryImpl) UpdateDefaultPolicyByRoleType(newPolicy string, roleType bean2.RoleType) (err error)

func (UserAuthRepositoryImpl) UpdateTriggerPolicyForTerminalAccess

func (impl UserAuthRepositoryImpl) UpdateTriggerPolicyForTerminalAccess() (err error)

type UserModel

type UserModel struct {
	TableName   struct{}   `sql:"users" pg:",discard_unknown_columns"`
	Id          int32      `sql:"id,pk"`
	EmailId     string     `sql:"email_id,notnull"`
	AccessToken string     `sql:"access_token"`
	Active      bool       `sql:"active,notnull"`
	UserType    string     `sql:"user_type"`
	UserAudit   *UserAudit `sql:"-"`
	sql.AuditLog
}

type UserRepository

type UserRepository interface {
	CreateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)
	UpdateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)
	UpdateToInactiveByIds(ids []int32, tx *pg.Tx, loggedInUserId int32) error
	GetById(id int32) (*UserModel, error)
	GetEmailByIds(ids []int32) ([]string, error)
	GetByIdIncludeDeleted(id int32) (*UserModel, error)
	GetAllExcludingApiTokenUser() ([]UserModel, error)
	GetAllExecutingQuery(query string) ([]UserModel, error)
	//GetAllUserRoleMappingsForRoleId(roleId int) ([]UserRoleModel, error)
	FetchActiveUserByEmail(email string) (bean.UserInfo, error)
	FetchUserDetailByEmail(email string) (bean.UserInfo, error)
	GetByIds(ids []int32) ([]UserModel, error)
	GetConnection() (dbConnection *pg.DB)
	FetchUserMatchesByEmailIdExcludingApiTokenUser(email string) ([]UserModel, error)
	FetchActiveOrDeletedUserByEmail(email string) (*UserModel, error)
	UpdateRoleIdForUserRolesMappings(roleId int, newRoleId int) (*UserRoleModel, error)
	GetCountExecutingQuery(query string) (int, error)
	CheckIfTokenExistsByTokenNameAndVersion(tokenName string, tokenVersion int) (bool, error)
}

type UserRepositoryImpl

type UserRepositoryImpl struct {
	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewUserRepositoryImpl

func NewUserRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *UserRepositoryImpl

func (UserRepositoryImpl) CheckIfTokenExistsByTokenNameAndVersion added in v0.7.0

func (impl UserRepositoryImpl) CheckIfTokenExistsByTokenNameAndVersion(tokenName string, tokenVersion int) (bool, error)

below method does operation on api_token table, we are writing this method here instead of ApiTokenRepository to avoid cyclic import

func (UserRepositoryImpl) CreateUser

func (impl UserRepositoryImpl) CreateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)

func (UserRepositoryImpl) FetchActiveOrDeletedUserByEmail

func (impl UserRepositoryImpl) FetchActiveOrDeletedUserByEmail(email string) (*UserModel, error)

func (UserRepositoryImpl) FetchActiveUserByEmail

func (impl UserRepositoryImpl) FetchActiveUserByEmail(email string) (bean.UserInfo, error)

func (UserRepositoryImpl) FetchUserDetailByEmail

func (impl UserRepositoryImpl) FetchUserDetailByEmail(email string) (bean.UserInfo, error)

func (UserRepositoryImpl) FetchUserMatchesByEmailIdExcludingApiTokenUser

func (impl UserRepositoryImpl) FetchUserMatchesByEmailIdExcludingApiTokenUser(email string) ([]UserModel, error)

func (UserRepositoryImpl) GetAllExcludingApiTokenUser

func (impl UserRepositoryImpl) GetAllExcludingApiTokenUser() ([]UserModel, error)

func (UserRepositoryImpl) GetAllExecutingQuery added in v0.6.29

func (impl UserRepositoryImpl) GetAllExecutingQuery(query string) ([]UserModel, error)

func (UserRepositoryImpl) GetById

func (impl UserRepositoryImpl) GetById(id int32) (*UserModel, error)

func (UserRepositoryImpl) GetByIdIncludeDeleted

func (impl UserRepositoryImpl) GetByIdIncludeDeleted(id int32) (*UserModel, error)

func (UserRepositoryImpl) GetByIds

func (impl UserRepositoryImpl) GetByIds(ids []int32) ([]UserModel, error)

func (*UserRepositoryImpl) GetConnection

func (impl *UserRepositoryImpl) GetConnection() (dbConnection *pg.DB)

func (UserRepositoryImpl) GetCountExecutingQuery added in v0.6.29

func (impl UserRepositoryImpl) GetCountExecutingQuery(query string) (int, error)

func (UserRepositoryImpl) GetEmailByIds added in v0.6.29

func (impl UserRepositoryImpl) GetEmailByIds(ids []int32) ([]string, error)

func (UserRepositoryImpl) UpdateRoleIdForUserRolesMappings

func (impl UserRepositoryImpl) UpdateRoleIdForUserRolesMappings(roleId int, newRoleId int) (*UserRoleModel, error)

func (UserRepositoryImpl) UpdateToInactiveByIds added in v0.6.29

func (impl UserRepositoryImpl) UpdateToInactiveByIds(ids []int32, tx *pg.Tx, loggedInUserId int32) error

func (UserRepositoryImpl) UpdateUser

func (impl UserRepositoryImpl) UpdateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)

type UserRoleModel

type UserRoleModel struct {
	TableName struct{} `sql:"user_roles" pg:",discard_unknown_columns"`
	Id        int      `sql:"id,pk"`
	UserId    int32    `sql:"user_id,notnull"`
	RoleId    int      `sql:"role_id,notnull"`
	User      UserModel
	sql.AuditLog
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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