Skip to content
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

feat(console): Disable admin privileges for paid seats on payment failures/stops #2709

Conversation

Cosmin-Parvulescu
Copy link
Contributor

@Cosmin-Parvulescu Cosmin-Parvulescu commented Oct 9, 2023

Description

  • Added group payment failed flag across app models on frontend
  • Added seat payment failed toasts on group / group billing / app dashboard and app list pages
  • Added seat payment failed pills on group / app lists
  • Added indicator on menu selected app when seat payment failed
  • Added paymentFailedIdentityGroups list on context that gets passed down to multiple route endpoints
  • Added client side checks for groupURN part of paymentFailedIdentityGroups
  • Added endpoints for retrieving group urns where payment failed
  • Added async loader in console root for said list
  • Updated reconcileSubscriptions to handle sub / invoice states internally
  • Added group security feature that checks in the DO whether the current user is allowed to operate on the group
  • Added check on group action endpoints
  • Updated group operations to keep members in sync Graph <-> DO

Related Issues

Testing

  • Payment failed condition can be enabled by buying two seats in a group, inviting people to fill the spaces and then reducing the number of seats to 1 in the Stripe dashboard.

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have tested my code (manually and/or automated if applicable)
  • I have updated the documentation (if necessary)

@Cosmin-Parvulescu Cosmin-Parvulescu added the enhancement Indicates new feature requests label Oct 9, 2023
@Cosmin-Parvulescu Cosmin-Parvulescu self-assigned this Oct 9, 2023
@Cosmin-Parvulescu Cosmin-Parvulescu marked this pull request as ready for review October 9, 2023 11:53
if (!freeMembers.includes(identityURN)) {
return {
error: new UnauthorizedError({
message: 'Unauthorized',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a bit more descriptive, talking about lack of administrative permissions to change/create/delete.

if (!members.includes(identityURN)) {
return {
error: new UnauthorizedError({
message: 'Unauthorized',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above

@Cosmin-Parvulescu Cosmin-Parvulescu force-pushed the feat/console/Disable-admin-privileges-for-paid-seats-on-payment-failures-stops branch from 0a8ebad to 5870cbd Compare October 10, 2023 10:30
@@ -23,6 +31,21 @@ export const rotateApiKey = async ({
`Request received for clientId ${input.clientId} which is not owned by provided account.`
)

const caller = router.createCaller(ctx)
const { edges: appOwnershipEdges } = await caller.edges.getEdges({
query: { dst: { baseUrn: appURN }, tag: EDGE_APPLICATION },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, pull this out into a function and use where appropriate in the starbase mutation procs.

throw new UnauthorizedError({
message: 'You are not authorized to update this identity group.',
message: 'You are not authorized to read this identity group.',
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further below, when stripe payer data is updated, even when payment information isn't updated, the flag is being reset and the CTA/warnings for seats needed vs. seats available go away.

@@ -194,6 +197,21 @@ export default () => {
) : null}
</section>

{groupURN && paymentFailedIdentityGroups.includes(groupURN) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting the comment here as reminder: Seat numbers in billing page should be calculated taking into account invited/pending users, not only the ones who have accepted the invitation.

@Cosmin-Parvulescu Cosmin-Parvulescu force-pushed the feat/console/Disable-admin-privileges-for-paid-seats-on-payment-failures-stops branch 2 times, most recently from 5ea3654 to 0d6fdcf Compare October 11, 2023 10:47
@Cosmin-Parvulescu Cosmin-Parvulescu force-pushed the feat/console/Disable-admin-privileges-for-paid-seats-on-payment-failures-stops branch from 0d6fdcf to 7e4768a Compare October 16, 2023 09:05
@betimshahini betimshahini merged commit 4a2ebd3 into main Oct 16, 2023
15 of 16 checks passed
@betimshahini betimshahini deleted the feat/console/Disable-admin-privileges-for-paid-seats-on-payment-failures-stops branch October 16, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(console): Disable admin privileges for paid seats on payment failures/stops
2 participants