top of page
Search
Writer's pictureDave Parrish

Shared Pages & User Permissions in your Knack Database App




Hey folks, Dave Parrish here! I’ve got another video blog for you today, and this one dives into something I often get asked about: shared pages and how to manage permissions for different user roles effectively. This is a topic I’ve touched on before, but something came up recently that made me want to revisit it and share a fresh perspective.


So, if you've ever created a shared page and needed multiple users to interact with it but wanted to limit what they can do, you’re in the right place. This blog post will walk you through a practical use case I encountered recently, showing how different user roles, permissions, and page content can interact to give you precise control over your platform’s functionality.


Let’s get into it!


What Are Shared Pages, and Why Are They Useful?

If you’re building a page that multiple users will interact with, you may want to avoid duplicating work. Instead of creating multiple pages for each user or role, you can use a shared page. This lets you build a single page that several users can access and modify, but with different levels of permissions based on their user role. It saves time and ensures consistency.


User Roles and Permissions: The Basics

Now, let’s break down how permissions work. When you’re dealing with different user roles (like Admins, Editors, or Viewers), it’s not just about granting access. It’s about defining what each user can and can’t do. For example, one user might only need to view content, while another might need full editing rights. You want to set this up efficiently so that the right users can access the right tools.


In my workflow, I often use an add/update rights field to define whether a user has permission to edit or not. This field is marked with a "yes" or "no," and it plays a crucial role in determining what content each user can interact with.


Managing Content for Different User Roles

Here’s a scenario I recently worked on where this concept really came to life. I took over a project from a fellow builder (who’s really good at what he does), and I noticed something that seemed like a hack at first. But, after diving deeper, I realized it was actually a pretty smart and legitimate way to manage user permissions—one that I now use regularly.

Let me walk you through how it works.


I had two tables on the page: one for viewing member contacts and another for editing them. The tables were essentially the same, but the key difference was that one had an edit button, and the other didn’t. The content was almost identical, but the editing permissions were handled differently.


Here’s how I set it up:

  • For the edit-enabled table, if a user has the right to update, the page would show the edit button.

  • For the view-only table, the button is hidden because the user doesn’t have permission to edit that section.


It’s a neat solution because the tables were essentially duplicated, but by showing or hiding certain elements based on the user’s permissions, I created a seamless experience without unnecessary complexity.


Why Hide and Show?

You might be wondering, why not just display everything and restrict access in the backend? The reason I opted for a hide/show rule is that it’s often cleaner and more intuitive for the user. Plus, it lets me control which elements are visible based on the user’s permissions, without needing to overcomplicate the page structure.


For example, in a situation where certain users can’t delete data, I used a similar approach:

  • If a user doesn’t have permission to delete, the delete button would simply not appear.

  • If a user does have permission, the button would show up.

This helps keep the interface simple and intuitive while ensuring users only see the options that apply to them.


Dealing with Permissions and Deletion

Now, let's talk about something a bit trickier: deleting data. If you’ve got a table where some users can delete records, but others can’t, things get a little more complicated. For example, on a table where users have the ability to edit and delete, you can’t simply use field-level permissions to manage the delete action.


Instead, you can handle it through page rules:

  • If the user has delete permissions, you can show the delete button.

  • If they don’t, you can hide it.


Alternatively, if you just want to prevent access entirely, you could use a pop-up or message to notify users that their permissions don’t allow them to perform certain actions, such as deletion. It’s a slightly more blunt approach, but it gets the job done.


Making It Clean and User-Friendly

Some people don’t like showing a message like “Your permissions don’t allow access to this page,” because it can feel a bit harsh. Instead, many prefer to keep the interface clean and just hide the content or functionality entirely. It’s all about striking the right balance between functionality and user experience.


But remember, you can always fine-tune this approach based on what’s best for your app and your users. Some situations may require more transparency, while others can rely on cleaner, simpler design.


Shared Pages Are Powerful, but Permissions Matter

This blog post covers just one specific use case of shared pages and user permissions—but there are countless ways to use this technique depending on your needs. Whether you’re managing access to editing, deleting, or just viewing content, the ability to fine-tune permissions is key to creating a functional and secure app.


If you’d like more details on how to handle permissions, check out my previous, more in-depth video on this topic. I dive deeper into other ways to share content and manage user roles.


Thanks for reading, and stay tuned for more tips and tricks in the future!


Interested in my Knack database services? ... Book a call with me here: https://calendly.com/daveparrish/callwithdave 




4 views0 comments

Recent Posts

See All

Comments


bottom of page