MSP-3428 CRUD application_group, service -> application_group
This commit is contained in:
1 parent
7108122102
commit
bef400d0d9
26 files changed
+559
-395
No files matched your search
@@ -17,22 +17,22 @@ type AccessListRep interface {
|
||||
GetAccessListByAppIdAndMethod(ctx context.Context, appId int, method string) (*entity.AccessList, error)
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
type ApplicationGroup struct {
|
||||
tokenRep TokenRep
|
||||
accessListRep AccessListRep
|
||||
}
|
||||
|
||||
func NewService(
|
||||
func NewApplicationGroup(
|
||||
tokenRep TokenRep,
|
||||
accessListRep AccessListRep,
|
||||
) Service {
|
||||
return Service{
|
||||
) ApplicationGroup {
|
||||
return ApplicationGroup{
|
||||
tokenRep: tokenRep,
|
||||
accessListRep: accessListRep,
|
||||
}
|
||||
}
|
||||
|
||||
func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthData, error) {
|
||||
func (s ApplicationGroup) Authenticate(ctx context.Context, token string) (*domain.AuthData, error) {
|
||||
authData, err := s.tokenRep.AuthDataByToken(ctx, token)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "get auth data by token")
|
||||
@@ -44,14 +44,14 @@ func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthDa
|
||||
}
|
||||
|
||||
return &domain.AuthData{
|
||||
SystemId: authData.SystemId,
|
||||
DomainId: authData.DomainId,
|
||||
ServiceId: authData.ServiceId,
|
||||
ApplicationId: authData.AppId,
|
||||
SystemId: authData.SystemId,
|
||||
DomainId: authData.DomainId,
|
||||
ApplicationGroupId: authData.ApplicationGroupIdId,
|
||||
ApplicationId: authData.AppId,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s Service) Authorize(ctx context.Context, appId int, endpoint string) (bool, error) {
|
||||
func (s ApplicationGroup) Authorize(ctx context.Context, appId int, endpoint string) (bool, error) {
|
||||
accessList, err := s.accessListRep.GetAccessListByAppIdAndMethod(ctx, appId, endpoint)
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "get access list by app_id and method")
|
||||
Reference in new issue
Block a user