human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Remove organization_name from URLs

Open dorner opened this issue 1 year ago • 11 comments

Summary

Currently, we add organization_name to the base URLs. This was added before we had the concept of roles. Now that we allow people to switch roles, we no longer need this in our URLs. We should remove the name entirely.

Things to consider

We will need to ensure that any route that a superadmin can reach (e.g. organization/show, partner/show) has support for organization_id. We will need to check that ID only if the current user is a superadmin.

Criteria for Completion

  • [] organization_name is removed from all routes
  • All links from superadmin pages work correctly
  • All existing routes work correctly

dorner avatar Mar 31 '24 14:03 dorner

I'd like to help with this issue!

jp524 avatar Apr 11 '24 11:04 jp524

Give it a go! Let me know if you have any questions.

dorner avatar Apr 11 '24 12:04 dorner

I had the chance to start looking at this today. While logged in as a user with roles super_admin and org_user, I noticed that clicking on the My Organization link from the admin dashboard gives an error (see screenshot below). Is this an example what of you meant in the Things to consider section of the issue? Screenshot 2024-04-11 at 19 06 03

jp524 avatar Apr 11 '24 23:04 jp524

Yep. When logged in as a superadmin, that link doesn't even make sense since super admin roles don't belong to an organization. We should probably just remove that link in this case.

dorner avatar Apr 12 '24 19:04 dorner

Is the code showing the link perhaps just checking if the user has the role, rather than if they are acting as that role? I don't see it when I'm logged in as just a superuser.

cielf avatar Apr 12 '24 19:04 cielf

@dorner @cielf The link only appears when a user is both a super admin and an organization user. You can see the logic this system test.

In the development database built from seeds, an example of a user that has both roles if the one with email [email protected].

Before changing any of the logic I'd like to make sure I properly understand the interaction between super admin and the other roles. I believed that super admins where restricted to routes within the namespace admin, but that link My Organization seems to show otherwise.

jp524 avatar Apr 12 '24 20:04 jp524

If can join Sunday office hours if it's easier to discuss this then :)

jp524 avatar Apr 12 '24 20:04 jp524

Yep - I think this is a mistake. Super users won't also be org admins, and if they are, they should just switch roles to the org admin role and we should decouple them entirely.

dorner avatar Apr 12 '24 20:04 dorner

Okay that makes sense to me. I think decoupling the roles should be a separate issue so I'll first tackle this issue and open a second issue for the roles.

jp524 avatar Apr 13 '24 15:04 jp524

RE the things-to-consider for superadmin -- any route that a superadmin can reach (e.g. organization/show, partner/show) -- are you talking about like /admin/organization/232 paths, or something else they can get to? We were looking at this in office hours and I'm not sure how superadmin (when acting as the superadmin role) can get to any short-name urls already. I'm thinking the answer here is -- ah, no, they don't actually go there, nothing to see here, thanks for checking. eh?

awwaiid avatar Apr 14 '24 15:04 awwaiid

I believe you're right - but part of this ticket will be to validate and double check that. 🙂

dorner avatar Apr 15 '24 00:04 dorner

This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned.

github-actions[bot] avatar May 16 '24 00:05 github-actions[bot]