-
Notifications
You must be signed in to change notification settings - Fork 8
feat(sentinel): impl sentinel #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0b9841a
feat(sentinel): add sentinel service to app
Tabing010102 c14521b
feat(sentinel): impl RefreshToken
Tabing010102 25b18d0
fix(sentinel): add UnimplementedServer
Tabing010102 ceb0947
feat(sentinel): add models, rebase, remove unused
Tabing010102 e3a8f73
feat(sentinel): add sentinel refresh token
Tabing010102 cd190df
feat(sentinel): update model, impl ReportSentinelInformation
Tabing010102 f4be331
chore(sentinel): rename update to upsert
Tabing010102 c3a1159
feat(sentinel): impl ReportAppBinaries
Tabing010102 f5fa8b8
chore(sentinel): change oldLibsMap to lo
Tabing010102 a4c1e1f
fix(sentinel): typo
Tabing010102 abe141f
feat(sentinel): change model
Tabing010102 83547fe
feat(sentinel): update biz, repo for new models
Tabing010102 5ca75a0
feat(sentinel): update model, biz, repo
Tabing010102 8cece4b
fix(sentinel): set appBinaryReportSeq in UpsertSentinelInfo
Tabing010102 d4acc95
fix(sentinel): change to UpdateSentinelInfo
Tabing010102 64faebf
fix(sentinel): update SentinelInfo by UpdateOneID
Tabing010102 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package bizgebura | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/tuihub/librarian/internal/biz/bizutils" | ||
| "github.com/tuihub/librarian/internal/lib/libauth" | ||
| "github.com/tuihub/librarian/internal/model" | ||
| "github.com/tuihub/librarian/internal/model/modelgebura" | ||
| pb "github.com/tuihub/protos/pkg/librarian/sephirah/v1" | ||
| ) | ||
|
|
||
| func (g *Gebura) UpsertSentinelInfo( | ||
| ctx context.Context, info *modelgebura.SentinelInfo, | ||
| ) error { | ||
| claims := libauth.FromContextAssertUserType(ctx, model.UserTypeSentinel) | ||
| if claims == nil { | ||
| return bizutils.NoPermissionError() | ||
| } | ||
| info.ID = claims.UserID | ||
| err := g.repo.UpdateSentinelInfo(ctx, info) | ||
| if err != nil { | ||
| return pb.ErrorErrorReasonUnspecified("%s", err.Error()) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func (g *Gebura) UpsertAppBinaries( | ||
| ctx context.Context, abs []*modelgebura.SentinelAppBinary, | ||
| ) error { | ||
| claims := libauth.FromContextAssertUserType(ctx, model.UserTypeSentinel) | ||
| if claims == nil { | ||
| return bizutils.NoPermissionError() | ||
| } | ||
| sentinelID := claims.UserID | ||
| err := g.repo.UpsertAppBinaries(ctx, sentinelID, abs) | ||
| if err != nil { | ||
| return pb.ErrorErrorReasonUnspecified("%s", err.Error()) | ||
| } | ||
| return nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query before update