Rename user into identity
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -52,7 +52,7 @@ type (
|
||||
)
|
||||
|
||||
func ensureAuthenticated(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
if identity == nil {
|
||||
return func(ctx context.Context) *graphql.Response {
|
||||
@@ -228,7 +228,7 @@ func NewMux(
|
||||
panic(fmt.Errorf("cannot parse organization id: %w", err))
|
||||
}
|
||||
|
||||
identity := connect_v1.UserFromContext(r.Context())
|
||||
identity := connect_v1.IdentityFromContext(r.Context())
|
||||
apiKey := connect_v1.APIKeyFromContext(r.Context())
|
||||
if identity == nil {
|
||||
httpserver.RenderError(w, http.StatusUnauthorized, fmt.Errorf("authentication required"))
|
||||
@@ -328,7 +328,7 @@ func GetTenantService(ctx context.Context, proboSvc *probo.Service, tenantID gid
|
||||
}
|
||||
|
||||
func (r *Resolver) MustBeAuthorized(ctx context.Context, entityID gid.GID, action iam.Action) {
|
||||
user := connect_v1.UserFromContext(ctx)
|
||||
user := connect_v1.IdentityFromContext(ctx)
|
||||
apiKey := connect_v1.APIKeyFromContext(ctx)
|
||||
|
||||
var credentialID *gid.GID
|
||||
|
||||
@@ -967,7 +967,7 @@ func (r *documentVersionResolver) Signatures(ctx context.Context, obj *types.Doc
|
||||
func (r *documentVersionResolver) Signed(ctx context.Context, obj *types.DocumentVersion) (bool, error) {
|
||||
r.MustBeAuthorized(ctx, obj.ID, iam.ActionGetSigned)
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
if identity == nil {
|
||||
panic(fmt.Errorf("user not found in context"))
|
||||
}
|
||||
@@ -1758,7 +1758,7 @@ func (r *mutationResolver) DeleteTrustCenterFile(ctx context.Context, input type
|
||||
|
||||
// CreatePeople is the resolver for the createPeople field.
|
||||
func (r *mutationResolver) CreatePeople(ctx context.Context, input types.CreatePeopleInput) (*types.CreatePeoplePayload, error) {
|
||||
user := connect_v1.UserFromContext(ctx)
|
||||
user := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
r.iam.Authorizer.Authorize(ctx, iam.AuthorizeParams{
|
||||
Principal: user.ID,
|
||||
@@ -2165,7 +2165,7 @@ func (r *mutationResolver) ExportFramework(ctx context.Context, input types.Expo
|
||||
r.MustBeAuthorized(ctx, input.FrameworkID, iam.ActionExportFramework)
|
||||
|
||||
prb := r.ProboService(ctx, input.FrameworkID.TenantID())
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
err, exportJobID := prb.Frameworks.RequestExport(
|
||||
ctx,
|
||||
@@ -3257,7 +3257,7 @@ func (r *mutationResolver) PublishDocumentVersion(ctx context.Context, input typ
|
||||
|
||||
prb := r.ProboService(ctx, input.DocumentID.TenantID())
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
document, documentVersion, err := prb.Documents.PublishVersion(ctx, input.DocumentID, identity.ID, input.Changelog)
|
||||
if err != nil {
|
||||
@@ -3287,7 +3287,7 @@ func (r *mutationResolver) BulkPublishDocumentVersions(ctx context.Context, inpu
|
||||
|
||||
prb := r.ProboService(ctx, input.DocumentIds[0].TenantID())
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
documentVersions, documents, err := prb.Documents.BulkPublishVersions(
|
||||
ctx,
|
||||
@@ -3343,7 +3343,7 @@ func (r *mutationResolver) BulkExportDocuments(ctx context.Context, input types.
|
||||
|
||||
prb := r.ProboService(ctx, input.DocumentIds[0].TenantID())
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
options := probo.ExportPDFOptions{
|
||||
WithWatermark: input.WithWatermark,
|
||||
@@ -3514,7 +3514,7 @@ func (r *mutationResolver) CancelSignatureRequest(ctx context.Context, input typ
|
||||
func (r *mutationResolver) SignDocument(ctx context.Context, input types.SignDocumentInput) (*types.SignDocumentPayload, error) {
|
||||
r.MustBeAuthorized(ctx, input.DocumentVersionID, iam.ActionSignDocument)
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
prb := r.ProboService(ctx, input.DocumentVersionID.TenantID())
|
||||
|
||||
documentVersionSignature, err := prb.Documents.SignDocumentVersionByEmail(ctx, input.DocumentVersionID, identity.EmailAddress)
|
||||
@@ -3564,7 +3564,7 @@ func (r *mutationResolver) ExportSignableVersionDocumentPDF(ctx context.Context,
|
||||
panic(fmt.Errorf("cannot get document version: %w", err))
|
||||
}
|
||||
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
documentFilter := coredata.NewDocumentFilter(nil).WithUserEmail(&identity.EmailAddress)
|
||||
|
||||
_, err = prb.Documents.GetWithFilter(ctx, documentVersion.DocumentID, documentFilter)
|
||||
@@ -5919,7 +5919,8 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
|
||||
|
||||
// Viewer is the resolver for the viewer field.
|
||||
func (r *queryResolver) Viewer(ctx context.Context) (*types.Viewer, error) {
|
||||
identity := connect_v1.UserFromContext(ctx)
|
||||
identity := connect_v1.IdentityFromContext(ctx)
|
||||
|
||||
session := connect_v1.SessionFromContext(ctx)
|
||||
apiKey := connect_v1.APIKeyFromContext(ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user