Fix e2e tests

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-06 14:38:14 +04:00
parent 9243681f1b
commit 8d20220c86
25 changed files with 323 additions and 1142 deletions

View File

@@ -84,6 +84,18 @@ var IAMSelfManageInvitationPolicy = policy.NewPolicy(
).
WithDescription("Allows users to view and accept invitations sent to them")
// IAMSelfManageProfilePolicy allows users to view their own profiles.
var IAMSelfManageProfilePolicy = policy.NewPolicy(
"iam:self-manage-profile",
"Self-Manage Profiles",
// Users can view their own profiles
policy.Allow(ActionMembershipProfileGet).
WithSID("view-own-profiles").
When(policy.Equals("principal.id", "resource.identity_id")),
).
WithDescription("Allows users to view their organization profiles")
// IAMSelfManageMembershipPolicy allows users to view their own memberships.
var IAMSelfManageMembershipPolicy = policy.NewPolicy(
"iam:self-manage-membership",

View File

@@ -504,9 +504,9 @@ func (s *OrganizationService) CreateOrganization(
ctx context.Context,
identityID gid.GID,
req *CreateOrganizationRequest,
) (*coredata.Organization, error) {
) (*coredata.Organization, *coredata.Membership, error) {
if err := req.Validate(); err != nil {
return nil, fmt.Errorf("invalid request: %w", err)
return nil, nil, fmt.Errorf("invalid request: %w", err)
}
var (
@@ -584,7 +584,7 @@ func (s *OrganizationService) CreateOrganization(
)
if err != nil {
return nil, fmt.Errorf("cannot upload logo file: %w", err)
return nil, nil, fmt.Errorf("cannot upload logo file: %w", err)
}
logoFile.FileSize = fileSize
@@ -621,7 +621,7 @@ func (s *OrganizationService) CreateOrganization(
)
if err != nil {
return nil, fmt.Errorf("cannot upload logo file: %w", err)
return nil, nil, fmt.Errorf("cannot upload logo file: %w", err)
}
horizontalLogoFile.FileSize = fileSize
@@ -713,10 +713,10 @@ func (s *OrganizationService) CreateOrganization(
},
)
if err != nil {
return nil, fmt.Errorf("cannot insert organization: %w", err)
return nil, nil, fmt.Errorf("cannot insert organization: %w", err)
}
return organization, nil
return organization, membership, nil
}
func (s *OrganizationService) UpdateOrganization(ctx context.Context, organizationID gid.GID, req *UpdateOrganizationRequest) (*coredata.Organization, error) {

View File

@@ -66,6 +66,7 @@ func IAMPolicySet() *PolicySet {
IAMSelfManageIdentityPolicy,
IAMSelfManageSessionPolicy,
IAMSelfManageInvitationPolicy,
IAMSelfManageProfilePolicy,
IAMSelfManageMembershipPolicy,
IAMSelfManagePersonalAPIKeyPolicy,
)