Skip to content

Solidify permissions and licensing checks in the UI for Org feature set #13915

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

Closed
13 tasks done
Tracked by #13241
Kira-Pilot opened this issue Jul 16, 2024 · 12 comments · Fixed by #14404
Closed
13 tasks done
Tracked by #13241

Solidify permissions and licensing checks in the UI for Org feature set #13915

Kira-Pilot opened this issue Jul 16, 2024 · 12 comments · Fixed by #14404
Assignees
Labels
enterprise Enterprise-license / premium functionality site Area: frontend dashboard

Comments

@Kira-Pilot
Copy link
Member

Kira-Pilot commented Jul 16, 2024

Orgs is an enterprise feature. We should ensure it is effectively and coherently gated prior to releasing as an experiment.

Requirements

  • experiment name should be appropriate and documented
  • add small notice if experiment is enabled but user does not have premium license
  • make sure org features cannot be accessed and orgs cannot be created without a premium license
  • change site-wide permissions to be org-scoped where necessary in line with this PR
  • ensure that the UI doesn't error for single-org deployment after we've added all these new org features
  • add Jest tests for above cases
  • Organization sidebar settings should be conditional based on actor's capabilities.
    • "Organization Settings" should change to "Organization Summary" if the user cannot organization.<org_id>.update
    • See comment below for conditional ideas
  • Docs link for orgs/premium license
  • Update middleware error to say premium instead of enterprise
  • Show summary if not entitled

Known issues

  • groups page user dropdown shows all users on the site, not just members of the organizatinon. When adding a user to the group if they are not in the org, you get an error "User must be a member of organization "rabbit-group""
@Emyrk
Copy link
Member

Emyrk commented Jul 30, 2024

Related: #14057

@code-asher
Copy link
Member

code-asher commented Aug 6, 2024

Something that needs to be addressed is that you might see organizations you cannot edit in the sidebar. Right now I am showing a "you cannot edit this org" message, but maybe we will want to filter out organizations the user cannot edit (no easy way to do this right now I think aside from making an auth check for each org)?

But there is also currently a halfway state where the user cannot edit the org but they can see the audit log link, so in that case I am not sure what to do, because we still need the org to show up on the sidebar so they can get to the audit link. If we decide to get rid of the per-org audit links then it will resolve itself though.

We could have that page be a sort of summary page for the org instead of a settings page if you do not have permissions. Just displays the org name and description or something like that.

Edit: actually just going to still show the form but make it ineditable for now.

@Emyrk
Copy link
Member

Emyrk commented Aug 6, 2024

@code-asher I think we should do an auth check for each menu item, and show it conditionally.

Some pages like groups might be viewable if you have the read perm, but the "Create Button" might not be shown if they cannot make groups.

Screenshot from 2024-08-06 09-46-52

We could have that page be a sort of summary page for the org instead of a settings page if you do not have permissions. Just displays the org name and description or something like that.

I think this is a great idea. Then someone with no sidebar item perms, but can still see the org with organization.read will see something. Like Organization Summary instead of Organization Settings

@aslilac
Copy link
Member

aslilac commented Aug 6, 2024

no easy way to do this right now I think aside from making an auth check for each org

we do that in CreateTemplateForm already, shouldn't be too hard to do here too

edit: err, that PR is about to be merged but hasn't been yet #14174

@code-asher
Copy link
Member

Oh dope! I do actually run individual authcheck queries for the links under each org (so you should only see the sub-links you have permissions for), but I only do it at the point when the menu item is clicked and expanded because I was worried about firing off N queries all at once, but it sounds like that is probably the better way to do this, since that lets me hide the main org item entirely if the user has no permissions at all. Thanks for the guidance all!

And I will add a summary page for users who can see at least one link but cannot edit.

@Emyrk
Copy link
Member

Emyrk commented Aug 6, 2024

@code-asher authchecks can be batched into a single api call. So if you know all the auth checks up front, you could send all N in 1 call

@code-asher
Copy link
Member

code-asher commented Aug 6, 2024

Good grief how did I not realize that, I should have read Kayla's PR more closely, thank you that makes things incredibly easy.

Edit: oh wait I thought maybe there was some fancy nesting I could do but I think I just prefix IDs or something like that to do a multi-org query

Edit 2: yeah going to do org1.permission and then split on the . or something like that.

@Emyrk
Copy link
Member

Emyrk commented Aug 7, 2024

@code-asher the org1.permission is used when I do permissions. Like workspace.read. So I think the . is good 👍

@bpmct
Copy link
Member

bpmct commented Aug 15, 2024

I also noticed this if I have no license. We should probably hide it all. Apologies if this is somewhere in the issue already

Screenshot 2024-08-15 at 9 53 48 AM

@code-asher
Copy link
Member

code-asher commented Aug 16, 2024

Ah yup that makes sense to me, could bring the same license UI that is on the new org page I think. And/or show the summary instead of the settings? Not sure we want to hide in case the license expires and then they can no longer see their orgs.

@Emyrk
Copy link
Member

Emyrk commented Aug 21, 2024

@bpmct I don't think we should hide all org stuff without the license. There is still an existence of organizations, and licenses can expire. Maybe we should have a conversation how to best handle this.

@code-asher
Copy link
Member

code-asher commented Aug 22, 2024

For now I made it show the summary page, but I def think we should rethink especially since that summary page is pretty lame, and it does not explain why you are seeing the summary page instead of the form (it should probably show that the feature is not entitled or something, maybe using the entitled badge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enterprise Enterprise-license / premium functionality site Area: frontend dashboard
Projects
None yet
5 participants