Documentation ¶
Index ¶
- Constants
- Variables
- func BuildRoleFilterKeyForCluster(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, ...)
- func BuildRoleFilterKeyForJobs(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, ...)
- func BuildRoleFilterKeyForOtherEntity(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, ...)
- func WhitelistChecker(url string) bool
- type CheckResponse
- type DexConfig
- type EntityKeyProcessor
- type RbacRoleService
- type RbacRoleServiceImpl
- type RoleGroupService
- type RoleGroupServiceImpl
- func (impl RoleGroupServiceImpl) BulkDeleteRoleGroups(request *bean.BulkDeleteRequest) (bool, error)
- func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForClusterEntity(roleFilter bean.RoleFilter, userId int32, model *repository.RoleGroup, ...) ([]casbin2.Policy, error)
- func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForJobsEntity(roleFilter bean.RoleFilter, userId int32, model *repository.RoleGroup, ...) ([]casbin2.Policy, error)
- func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForOtherEntity(roleFilter bean.RoleFilter, request *bean.RoleGroup, ...) ([]casbin2.Policy, error)
- func (impl RoleGroupServiceImpl) CreateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) DeleteRoleGroup(bean *bean.RoleGroup) (bool, error)
- func (impl RoleGroupServiceImpl) FetchDetailedRoleGroups(req *bean.ListingRequest) ([]*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroups() ([]*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsV2(req *bean.ListingRequest) (*bean.RoleGroupListingResponse, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsWithFilters(request *bean.ListingRequest) (*bean.RoleGroupListingResponse, error)
- func (impl RoleGroupServiceImpl) FetchRolesForUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]*bean.RoleFilter, error)
- func (impl RoleGroupServiceImpl) UpdateRoleGroup(request *bean.RoleGroup, token string, ...) (*bean.RoleGroup, error)
- type User
- type UserAudit
- type UserAuditService
- type UserAuditServiceImpl
- type UserAuthService
- type UserAuthServiceImpl
- func (impl UserAuthServiceImpl) AuthVerification(r *http.Request) (bool, string, error)
- func (impl UserAuthServiceImpl) CreateRole(roleData *bean.RoleData) (bool, error)
- func (impl UserAuthServiceImpl) DeleteRoles(entityType string, entityName string, tx *pg.Tx, envIdentifier string, ...) (err error)
- func (impl UserAuthServiceImpl) HandleDexCallback(w http.ResponseWriter, r *http.Request)
- func (impl UserAuthServiceImpl) HandleLogin(username string, password string) (string, error)
- func (impl UserAuthServiceImpl) HandleLoginWithClientIp(ctx context.Context, username, password, clientIp string) (string, error)
- func (impl UserAuthServiceImpl) HandleRefresh(w http.ResponseWriter, r *http.Request)
- type UserCommonService
- type UserCommonServiceImpl
- func (impl UserCommonServiceImpl) BuildRoleFilterForAllTypes(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, ...)
- func (impl UserCommonServiceImpl) BuildRoleFiltersAfterMerging(entityProcessors []EntityKeyProcessor, baseKey bean2.MergingBaseKey) []bean.RoleFilter
- func (impl UserCommonServiceImpl) CheckRbacForClusterEntity(cluster, namespace, group, kind, resource, token string, ...) bool
- func (impl UserCommonServiceImpl) CreateDefaultPoliciesForAllTypes(...) (bool, error, []casbin.Policy)
- func (impl UserCommonServiceImpl) CreateDefaultPoliciesForAllTypesV2(...) (bool, error, []casbin.Policy)
- func (impl UserCommonServiceImpl) DeleteRoleForUserFromCasbin(mappings map[string][]string) bool
- func (impl UserCommonServiceImpl) DeleteUserForRoleFromCasbin(mappings map[string][]string) bool
- func (impl UserCommonServiceImpl) GetCapacityForRoleFilter(roleFilters []bean.RoleFilter) (int, map[int]int)
- func (impl UserCommonServiceImpl) GetUniqueKeyForAllEntity(entityProcessor EntityKeyProcessor, baseToConsider bean2.MergingBaseKey) string
- func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository.UserRoleModel, ...) ([]casbin.Policy, []*repository.RoleModel, error)
- func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, ...) ([]casbin.Policy, []*repository.RoleModel, error)
- func (impl UserCommonServiceImpl) SetDefaultValuesIfNotPresent(request *bean.ListingRequest, isRoleGroup bool)
- type UserRbacConfig
- type UserSelfRegistrationService
- type UserSelfRegistrationServiceImpl
- func (impl *UserSelfRegistrationServiceImpl) CheckAndCreateUserIfConfigured(claims jwt.MapClaims) bool
- func (impl *UserSelfRegistrationServiceImpl) CheckSelfRegistrationRoles() (CheckResponse, error)
- func (impl *UserSelfRegistrationServiceImpl) GetAllSelfRegistrationRoles() ([]string, error)
- func (impl *UserSelfRegistrationServiceImpl) SelfRegister(emailId string) (*bean.UserInfo, error)
- type UserService
- type UserServiceImpl
- func (impl *UserServiceImpl) BulkDeleteUsers(request *bean.BulkDeleteRequest) (bool, error)
- func (impl *UserServiceImpl) CheckIfTokenIsValid(email string, version string) error
- func (impl *UserServiceImpl) CheckUserRoles(id int32) ([]string, error)
- func (impl *UserServiceImpl) CreateOrUpdateUserRolesForAllTypes(roleFilter bean.RoleFilter, userId int32, model *repository.UserModel, ...) ([]casbin2.Policy, bool, error)
- func (impl *UserServiceImpl) CreateUser(userInfo *bean.UserInfo, token string, ...) ([]*bean.UserInfo, error)
- func (impl *UserServiceImpl) DeleteUser(bean *bean.UserInfo) (bool, error)
- func (impl *UserServiceImpl) GetActiveEmailById(userId int32) (string, error)
- func (impl *UserServiceImpl) GetAll() ([]bean.UserInfo, error)
- func (impl *UserServiceImpl) GetAllDetailedUsers() ([]bean.UserInfo, error)
- func (impl *UserServiceImpl) GetAllWithFilters(request *bean.ListingRequest) (*bean.UserListingResponse, error)
- func (impl *UserServiceImpl) GetById(id int32) (*bean.UserInfo, error)
- func (impl *UserServiceImpl) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error)
- func (impl *UserServiceImpl) GetByIds(ids []int32) ([]bean.UserInfo, error)
- func (impl *UserServiceImpl) GetEmailAndVersionFromToken(token string) (string, string, error)
- func (impl *UserServiceImpl) GetEmailById(userId int32) (string, error)
- func (impl *UserServiceImpl) GetEmailFromToken(token string) (string, error)
- func (impl *UserServiceImpl) GetLoggedInUser(r *http.Request) (int32, error)
- func (impl *UserServiceImpl) GetRoleFiltersByUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]bean.RoleFilter, error)
- func (impl *UserServiceImpl) GetUserByToken(context context.Context, token string) (int32, string, error)
- func (impl *UserServiceImpl) IsSuperAdmin(userId int) (bool, error)
- func (impl *UserServiceImpl) SaveLoginAudit(emailId, clientIp string, id int32)
- func (impl *UserServiceImpl) SelfRegisterUserIfNotExists(userInfo *bean.UserInfo) ([]*bean.UserInfo, error)
- func (impl *UserServiceImpl) SyncOrchestratorToCasbin() (bool, error)
- func (impl *UserServiceImpl) UpdateTriggerPolicyForTerminalAccess() (err error)
- func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, ...) (*bean.UserInfo, error)
- func (impl *UserServiceImpl) UserExists(emailId string) bool
- type WebhookToken
Constants ¶
View Source
const ( AllEnvironment string = "" AllNamespace string = "" AllGroup string = "" AllKind string = "" AllResource string = "" AllWorkflow string = "" )
View Source
const ( ConcurrentRequestLockError = "there is an ongoing request for this user, please try after some time" ConcurrentRequestUnlockError = "cannot block request that is not in process" )
Variables ¶
View Source
var ( CookieExpirationTime int JwtExpirationTime int )
Functions ¶
func BuildRoleFilterKeyForCluster ¶ added in v1.0.0
func BuildRoleFilterKeyForCluster(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, key string)
func BuildRoleFilterKeyForJobs ¶ added in v1.0.0
func BuildRoleFilterKeyForJobs(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, key string, baseToConsider bean2.MergingBaseKey)
func BuildRoleFilterKeyForOtherEntity ¶ added in v1.0.0
func BuildRoleFilterKeyForOtherEntity(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, key string, baseToConsider bean2.MergingBaseKey)
func WhitelistChecker ¶
Types ¶
type CheckResponse ¶
type DexConfig ¶
type DexConfig struct { RedirectURL string `env:"DEX_RURL" envDefault:"http://127.0.0.1:8080/callback"` ClientID string `env:"DEX_CID" envDefault:"example-app"` ClientSecret string `env:"DEX_SECRET" ` DexURL string `env:"DEX_URL" ` DexJwtKey string `env:"DEX_JWTKEY" ` CStoreKey string `env:"DEX_CSTOREKEY"` CookieExpirationTime int `env:"CExpirationTime" envDefault:"600"` JwtExpirationTime int `env:"JwtExpirationTime" envDefault:"120"` }
type EntityKeyProcessor ¶ added in v1.1.0
type EntityKeyProcessor interface { GetTeam() string GetEntity() string GetAction() string GetAccessType() string GetEnvironment() string GetCluster() string GetGroup() string GetKind() string GetEntityName() string GetResource() string GetWorkflow() string GetNamespace() string }
Defining a common interface for role and rolefilter
func ConvertRoleFiltersToEntityProcessors ¶ added in v1.1.0
func ConvertRoleFiltersToEntityProcessors(filters []bean.RoleFilter) []EntityKeyProcessor
func ConvertRolesToEntityProcessors ¶ added in v1.1.0
func ConvertRolesToEntityProcessors(roles []*repository.RoleModel) []EntityKeyProcessor
type RbacRoleService ¶
type RbacRoleService interface {
GetAllDefaultRoles() ([]*bean.RbacRoleDto, error)
}
type RbacRoleServiceImpl ¶
type RbacRoleServiceImpl struct {
// contains filtered or unexported fields
}
func NewRbacRoleServiceImpl ¶
func NewRbacRoleServiceImpl(logger *zap.SugaredLogger, rbacRoleDataRepository repository.RbacRoleDataRepository) *RbacRoleServiceImpl
func (*RbacRoleServiceImpl) GetAllDefaultRoles ¶
func (impl *RbacRoleServiceImpl) GetAllDefaultRoles() ([]*bean.RbacRoleDto, error)
type RoleGroupService ¶
type RoleGroupService interface { CreateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error) UpdateRoleGroup(request *bean.RoleGroup, token string, checkRBACForGroupUpdate func(token string, groupInfo *bean.RoleGroup, eliminatedRoleFilters []*repository.RoleModel, isRoleGroupAlreadySuperAdmin bool) (isAuthorised bool, err error), managerAuth func(resource, token string, object string) bool) (*bean.RoleGroup, error) FetchDetailedRoleGroups(req *bean.ListingRequest) ([]*bean.RoleGroup, error) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error) FetchRoleGroups() ([]*bean.RoleGroup, error) FetchRoleGroupsV2(req *bean.ListingRequest) (*bean.RoleGroupListingResponse, error) FetchRoleGroupsWithFilters(request *bean.ListingRequest) (*bean.RoleGroupListingResponse, error) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error) DeleteRoleGroup(model *bean.RoleGroup) (bool, error) BulkDeleteRoleGroups(request *bean.BulkDeleteRequest) (bool, error) FetchRolesForUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]*bean.RoleFilter, error) }
type RoleGroupServiceImpl ¶
type RoleGroupServiceImpl struct {
// contains filtered or unexported fields
}
func NewRoleGroupServiceImpl ¶
func NewRoleGroupServiceImpl(userAuthRepository repository.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository.UserRepository, roleGroupRepository repository.RoleGroupRepository, userCommonService UserCommonService) *RoleGroupServiceImpl
func (RoleGroupServiceImpl) BulkDeleteRoleGroups ¶ added in v0.6.29
func (impl RoleGroupServiceImpl) BulkDeleteRoleGroups(request *bean.BulkDeleteRequest) (bool, error)
BulkDeleteRoleGroups takes in bulk delete request and return error
func (RoleGroupServiceImpl) CreateOrUpdateRoleGroupForClusterEntity ¶
func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForClusterEntity(roleFilter bean.RoleFilter, userId int32, model *repository.RoleGroup, existingRoles map[int]*repository.RoleGroupRoleMapping, tx *pg.Tx, capacity int) ([]casbin2.Policy, error)
func (RoleGroupServiceImpl) CreateOrUpdateRoleGroupForJobsEntity ¶
func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForJobsEntity(roleFilter bean.RoleFilter, userId int32, model *repository.RoleGroup, existingRoles map[int]*repository.RoleGroupRoleMapping, tx *pg.Tx, capacity int) ([]casbin2.Policy, error)
func (RoleGroupServiceImpl) CreateOrUpdateRoleGroupForOtherEntity ¶
func (impl RoleGroupServiceImpl) CreateOrUpdateRoleGroupForOtherEntity(roleFilter bean.RoleFilter, request *bean.RoleGroup, model *repository.RoleGroup, existingRoles map[int]*repository.RoleGroupRoleMapping, tx *pg.Tx, capacity int) ([]casbin2.Policy, error)
func (RoleGroupServiceImpl) CreateRoleGroup ¶
func (RoleGroupServiceImpl) DeleteRoleGroup ¶
func (impl RoleGroupServiceImpl) DeleteRoleGroup(bean *bean.RoleGroup) (bool, error)
func (RoleGroupServiceImpl) FetchDetailedRoleGroups ¶
func (impl RoleGroupServiceImpl) FetchDetailedRoleGroups(req *bean.ListingRequest) ([]*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroups ¶
func (impl RoleGroupServiceImpl) FetchRoleGroups() ([]*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroupsById ¶
func (impl RoleGroupServiceImpl) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroupsByName ¶
func (impl RoleGroupServiceImpl) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroupsV2 ¶ added in v0.6.29
func (impl RoleGroupServiceImpl) FetchRoleGroupsV2(req *bean.ListingRequest) (*bean.RoleGroupListingResponse, error)
func (RoleGroupServiceImpl) FetchRoleGroupsWithFilters ¶ added in v0.6.29
func (impl RoleGroupServiceImpl) FetchRoleGroupsWithFilters(request *bean.ListingRequest) (*bean.RoleGroupListingResponse, error)
FetchRoleGroupsWithFilters takes listing request as input and outputs RoleGroupListingResponse based on the request filters.
func (RoleGroupServiceImpl) FetchRolesForUserRoleGroups ¶ added in v0.7.0
func (impl RoleGroupServiceImpl) FetchRolesForUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]*bean.RoleFilter, error)
func (RoleGroupServiceImpl) UpdateRoleGroup ¶
func (impl RoleGroupServiceImpl) UpdateRoleGroup(request *bean.RoleGroup, token string, checkRBACForGroupUpdate func(token string, groupInfo *bean.RoleGroup, eliminatedRoleFilters []*repository.RoleModel, isRoleGroupAlreadySuperAdmin bool) (isAuthorised bool, err error), managerAuth func(resource, token string, object string) bool) (*bean.RoleGroup, error)
type UserAuditService ¶
type UserAuditServiceImpl ¶
type UserAuditServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserAuditServiceImpl ¶
func NewUserAuditServiceImpl(logger *zap.SugaredLogger, userAuditRepository repository2.UserAuditRepository) *UserAuditServiceImpl
func (UserAuditServiceImpl) GetLatestByUserId ¶
func (impl UserAuditServiceImpl) GetLatestByUserId(userId int32) (*UserAudit, error)
func (UserAuditServiceImpl) GetLatestUser ¶
func (impl UserAuditServiceImpl) GetLatestUser() (*UserAudit, error)
func (UserAuditServiceImpl) Save ¶
func (impl UserAuditServiceImpl) Save(userAudit *UserAudit) error
func (UserAuditServiceImpl) Update ¶
func (impl UserAuditServiceImpl) Update(userAudit *UserAudit) error
type UserAuthService ¶
type UserAuthService interface { HandleLoginWithClientIp(ctx context.Context, username, password, clientIp string) (string, error) HandleLogin(username string, password string) (string, error) HandleDexCallback(w http.ResponseWriter, r *http.Request) HandleRefresh(w http.ResponseWriter, r *http.Request) CreateRole(roleData *bean.RoleData) (bool, error) AuthVerification(r *http.Request) (bool, string, error) DeleteRoles(entityType string, entityName string, tx *pg.Tx, envIdentifier string, workflowName string) error }
type UserAuthServiceImpl ¶
type UserAuthServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserAuthServiceImpl ¶
func NewUserAuthServiceImpl(userAuthRepository repository.UserAuthRepository, sessionManager *middleware.SessionManager, client session2.ServiceClient, logger *zap.SugaredLogger, userRepository repository.UserRepository, roleGroupRepository repository.RoleGroupRepository, userService UserService) *UserAuthServiceImpl
func (UserAuthServiceImpl) AuthVerification ¶
func (UserAuthServiceImpl) CreateRole ¶
func (impl UserAuthServiceImpl) CreateRole(roleData *bean.RoleData) (bool, error)
func (UserAuthServiceImpl) DeleteRoles ¶
func (UserAuthServiceImpl) HandleDexCallback ¶
func (impl UserAuthServiceImpl) HandleDexCallback(w http.ResponseWriter, r *http.Request)
func (UserAuthServiceImpl) HandleLogin ¶
func (impl UserAuthServiceImpl) HandleLogin(username string, password string) (string, error)
func (UserAuthServiceImpl) HandleLoginWithClientIp ¶
func (UserAuthServiceImpl) HandleRefresh ¶
func (impl UserAuthServiceImpl) HandleRefresh(w http.ResponseWriter, r *http.Request)
type UserCommonService ¶
type UserCommonService interface { CreateDefaultPoliciesForAllTypes(team, entityName, env, entity, cluster, namespace, group, kind, resource, actionType, accessType, workflow string, userId int32) (bool, error, []casbin.Policy) RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository.UserRoleModel, eliminatedRoleIds map[int]*repository.UserRoleModel, tx *pg.Tx, token string, managerAuth func(resource string, token string, object string) bool) ([]casbin.Policy, []*repository.RoleModel, error) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, existingRoles map[int]*repository.RoleGroupRoleMapping, eliminatedRoles map[int]*repository.RoleGroupRoleMapping, tx *pg.Tx, token string, managerAuth func(resource string, token string, object string) bool) ([]casbin.Policy, []*repository.RoleModel, error) CheckRbacForClusterEntity(cluster, namespace, group, kind, resource, token string, managerAuth func(resource, token, object string) bool) bool GetCapacityForRoleFilter(roleFilters []bean.RoleFilter) (int, map[int]int) BuildRoleFilterForAllTypes(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, key string, basetoConsider bean2.MergingBaseKey) GetUniqueKeyForAllEntity(entityProcessor EntityKeyProcessor, baseToConsider bean2.MergingBaseKey) string SetDefaultValuesIfNotPresent(request *bean.ListingRequest, isRoleGroup bool) DeleteRoleForUserFromCasbin(mappings map[string][]string) bool DeleteUserForRoleFromCasbin(mappings map[string][]string) bool BuildRoleFiltersAfterMerging(entityProcessors []EntityKeyProcessor, baseKey bean2.MergingBaseKey) []bean.RoleFilter }
type UserCommonServiceImpl ¶
type UserCommonServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserCommonServiceImpl ¶
func NewUserCommonServiceImpl(userAuthRepository repository.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository.UserRepository, userGroupRepository repository.RoleGroupRepository, sessionManager2 *middleware.SessionManager, defaultRbacDataCacheFactory repository.RbacDataCacheFactory) (*UserCommonServiceImpl, error)
func (UserCommonServiceImpl) BuildRoleFilterForAllTypes ¶
func (impl UserCommonServiceImpl) BuildRoleFilterForAllTypes(roleFilterMap map[string]*bean.RoleFilter, entityProcessor EntityKeyProcessor, key string, basetoConsider bean2.MergingBaseKey)
func (UserCommonServiceImpl) BuildRoleFiltersAfterMerging ¶ added in v1.1.0
func (impl UserCommonServiceImpl) BuildRoleFiltersAfterMerging(entityProcessors []EntityKeyProcessor, baseKey bean2.MergingBaseKey) []bean.RoleFilter
func (UserCommonServiceImpl) CheckRbacForClusterEntity ¶
func (impl UserCommonServiceImpl) CheckRbacForClusterEntity(cluster, namespace, group, kind, resource, token string, managerAuth func(resource, token, object string) bool) bool
func (UserCommonServiceImpl) CreateDefaultPoliciesForAllTypes ¶
func (UserCommonServiceImpl) CreateDefaultPoliciesForAllTypesV2 ¶
func (UserCommonServiceImpl) DeleteRoleForUserFromCasbin ¶ added in v0.6.29
func (impl UserCommonServiceImpl) DeleteRoleForUserFromCasbin(mappings map[string][]string) bool
func (UserCommonServiceImpl) DeleteUserForRoleFromCasbin ¶ added in v0.6.29
func (impl UserCommonServiceImpl) DeleteUserForRoleFromCasbin(mappings map[string][]string) bool
func (UserCommonServiceImpl) GetCapacityForRoleFilter ¶
func (impl UserCommonServiceImpl) GetCapacityForRoleFilter(roleFilters []bean.RoleFilter) (int, map[int]int)
func (UserCommonServiceImpl) GetUniqueKeyForAllEntity ¶
func (impl UserCommonServiceImpl) GetUniqueKeyForAllEntity(entityProcessor EntityKeyProcessor, baseToConsider bean2.MergingBaseKey) string
func (UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies ¶
func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository.UserRoleModel, eliminatedRoleIds map[int]*repository.UserRoleModel, tx *pg.Tx, token string, managerAuth func(resource string, token string, object string) bool) ([]casbin.Policy, []*repository.RoleModel, error)
func (UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups ¶
func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, existingRoles map[int]*repository.RoleGroupRoleMapping, eliminatedRoles map[int]*repository.RoleGroupRoleMapping, tx *pg.Tx, token string, managerAuth func(resource string, token string, object string) bool) ([]casbin.Policy, []*repository.RoleModel, error)
func (UserCommonServiceImpl) SetDefaultValuesIfNotPresent ¶ added in v0.6.29
func (impl UserCommonServiceImpl) SetDefaultValuesIfNotPresent(request *bean.ListingRequest, isRoleGroup bool)
type UserRbacConfig ¶
type UserRbacConfig struct {
UseRbacCreationV2 bool `env:"USE_RBAC_CREATION_V2" envDefault:"true"`
}
type UserSelfRegistrationServiceImpl ¶
type UserSelfRegistrationServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserSelfRegistrationServiceImpl ¶
func NewUserSelfRegistrationServiceImpl(logger *zap.SugaredLogger, selfRegistrationRolesRepository repository.SelfRegistrationRolesRepository, userService UserService) *UserSelfRegistrationServiceImpl
func (*UserSelfRegistrationServiceImpl) CheckAndCreateUserIfConfigured ¶
func (impl *UserSelfRegistrationServiceImpl) CheckAndCreateUserIfConfigured(claims jwt.MapClaims) bool
func (*UserSelfRegistrationServiceImpl) CheckSelfRegistrationRoles ¶
func (impl *UserSelfRegistrationServiceImpl) CheckSelfRegistrationRoles() (CheckResponse, error)
func (*UserSelfRegistrationServiceImpl) GetAllSelfRegistrationRoles ¶
func (impl *UserSelfRegistrationServiceImpl) GetAllSelfRegistrationRoles() ([]string, error)
func (*UserSelfRegistrationServiceImpl) SelfRegister ¶
func (impl *UserSelfRegistrationServiceImpl) SelfRegister(emailId string) (*bean.UserInfo, error)
type UserService ¶
type UserService interface { CreateUser(userInfo *bean.UserInfo, token string, managerAuth func(resource, token string, object string) bool) ([]*bean.UserInfo, error) SelfRegisterUserIfNotExists(userInfo *bean.UserInfo) ([]*bean.UserInfo, error) UpdateUser(userInfo *bean.UserInfo, token string, checkRBACForUserUpdate func(token string, userInfo *bean.UserInfo, isUserAlreadySuperAdmin bool, eliminatedRoleFilters, eliminatedGroupRoles []*repository.RoleModel, mapOfExistingUserRoleGroup map[string]bool) (isAuthorised bool, err error), managerAuth func(resource, token string, object string) bool) (*bean.UserInfo, error) GetById(id int32) (*bean.UserInfo, error) GetAll() ([]bean.UserInfo, error) GetAllWithFilters(request *bean.ListingRequest) (*bean.UserListingResponse, error) GetAllDetailedUsers() ([]bean.UserInfo, error) GetEmailFromToken(token string) (string, error) GetEmailAndVersionFromToken(token string) (string, string, error) // GetEmailById returns emailId by userId // - if user is not found then it returns bean.AnonymousUserEmail user email // - if user is found but inactive then it returns `emailId (inactive)` // - if user is found and active then it returns `emailId` GetEmailById(userId int32) (string, error) // GetActiveEmailById returns emailId by userId // - it only returns emailId if user is active // - if user is not found then it returns empty string // for audit emails use GetEmailById instead GetActiveEmailById(userId int32) (string, error) GetLoggedInUser(r *http.Request) (int32, error) GetByIds(ids []int32) ([]bean.UserInfo, error) DeleteUser(userInfo *bean.UserInfo) (bool, error) BulkDeleteUsers(request *bean.BulkDeleteRequest) (bool, error) CheckUserRoles(id int32) ([]string, error) SyncOrchestratorToCasbin() (bool, error) GetUserByToken(context context.Context, token string) (int32, string, error) //IsSuperAdmin(userId int) (bool, error) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error) UserExists(emailId string) bool UpdateTriggerPolicyForTerminalAccess() (err error) GetRoleFiltersByUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]bean.RoleFilter, error) SaveLoginAudit(emailId, clientIp string, id int32) CheckIfTokenIsValid(email string, version string) error }
type UserServiceImpl ¶
type UserServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserServiceImpl ¶
func NewUserServiceImpl(userAuthRepository repository.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository.UserRepository, userGroupRepository repository.RoleGroupRepository, sessionManager2 *middleware.SessionManager, userCommonService UserCommonService, userAuditService UserAuditService) *UserServiceImpl
func (*UserServiceImpl) BulkDeleteUsers ¶ added in v0.6.29
func (impl *UserServiceImpl) BulkDeleteUsers(request *bean.BulkDeleteRequest) (bool, error)
BulkDeleteUsers takes in BulkDeleteRequest and return success and error
func (*UserServiceImpl) CheckIfTokenIsValid ¶ added in v0.7.0
func (impl *UserServiceImpl) CheckIfTokenIsValid(email string, version string) error
func (*UserServiceImpl) CheckUserRoles ¶
func (impl *UserServiceImpl) CheckUserRoles(id int32) ([]string, error)
func (*UserServiceImpl) CreateOrUpdateUserRolesForAllTypes ¶
func (impl *UserServiceImpl) CreateOrUpdateUserRolesForAllTypes(roleFilter bean.RoleFilter, userId int32, model *repository.UserModel, existingRoles map[int]repository.UserRoleModel, tx *pg.Tx, entity string, capacity int) ([]casbin2.Policy, bool, error)
func (*UserServiceImpl) CreateUser ¶
func (*UserServiceImpl) DeleteUser ¶
func (impl *UserServiceImpl) DeleteUser(bean *bean.UserInfo) (bool, error)
func (*UserServiceImpl) GetActiveEmailById ¶ added in v1.0.0
func (impl *UserServiceImpl) GetActiveEmailById(userId int32) (string, error)
func (*UserServiceImpl) GetAll ¶
func (impl *UserServiceImpl) GetAll() ([]bean.UserInfo, error)
GetAll excluding API token user
func (*UserServiceImpl) GetAllDetailedUsers ¶
func (impl *UserServiceImpl) GetAllDetailedUsers() ([]bean.UserInfo, error)
func (*UserServiceImpl) GetAllWithFilters ¶ added in v0.6.29
func (impl *UserServiceImpl) GetAllWithFilters(request *bean.ListingRequest) (*bean.UserListingResponse, error)
GetAllWithFilters takes filter request gives UserListingResponse as output with some operations like filter, sorting, searching,pagination support inbuilt
func (*UserServiceImpl) GetById ¶
func (impl *UserServiceImpl) GetById(id int32) (*bean.UserInfo, error)
func (*UserServiceImpl) GetByIdIncludeDeleted ¶
func (impl *UserServiceImpl) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error)
func (*UserServiceImpl) GetByIds ¶
func (impl *UserServiceImpl) GetByIds(ids []int32) ([]bean.UserInfo, error)
func (*UserServiceImpl) GetEmailAndVersionFromToken ¶ added in v0.7.0
func (impl *UserServiceImpl) GetEmailAndVersionFromToken(token string) (string, string, error)
func (*UserServiceImpl) GetEmailById ¶
func (impl *UserServiceImpl) GetEmailById(userId int32) (string, error)
func (*UserServiceImpl) GetEmailFromToken ¶
func (impl *UserServiceImpl) GetEmailFromToken(token string) (string, error)
func (*UserServiceImpl) GetLoggedInUser ¶
func (impl *UserServiceImpl) GetLoggedInUser(r *http.Request) (int32, error)
func (*UserServiceImpl) GetRoleFiltersByUserRoleGroups ¶ added in v0.7.0
func (impl *UserServiceImpl) GetRoleFiltersByUserRoleGroups(userRoleGroups []bean.UserRoleGroup) ([]bean.RoleFilter, error)
func (*UserServiceImpl) GetUserByToken ¶
func (*UserServiceImpl) IsSuperAdmin ¶
func (impl *UserServiceImpl) IsSuperAdmin(userId int) (bool, error)
func (*UserServiceImpl) SaveLoginAudit ¶
func (impl *UserServiceImpl) SaveLoginAudit(emailId, clientIp string, id int32)
func (*UserServiceImpl) SelfRegisterUserIfNotExists ¶
func (*UserServiceImpl) SyncOrchestratorToCasbin ¶
func (impl *UserServiceImpl) SyncOrchestratorToCasbin() (bool, error)
func (*UserServiceImpl) UpdateTriggerPolicyForTerminalAccess ¶
func (impl *UserServiceImpl) UpdateTriggerPolicyForTerminalAccess() (err error)
func (*UserServiceImpl) UpdateUser ¶
func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, checkRBACForUserUpdate func(token string, userInfo *bean.UserInfo, isUserAlreadySuperAdmin bool, eliminatedRoleFilters, eliminatedGroupRoles []*repository.RoleModel, mapOfExistingUserRoleGroup map[string]bool) (isAuthorised bool, err error), managerAuth func(resource, token string, object string) bool) (*bean.UserInfo, error)
func (*UserServiceImpl) UserExists ¶
func (impl *UserServiceImpl) UserExists(emailId string) bool
type WebhookToken ¶
type WebhookToken struct {
WebhookToken string `env:"WEBHOOK_TOKEN" envDefault:""`
}
func GetWebhookToken ¶
func GetWebhookToken() (*WebhookToken, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.