Jump to content
  • 0

Separate tables or one big table for all people?


ClayG

Question

As I've been building a prototype application, I originally created 3 different tables for the 3 kinds of users (people) in my app, but now I'm thinking that was a bad idea and it would make more sense to just have a single table of all people but have a column for their "Role" which I would leverage for what level of access they will have to datapages, etc.

To give a little more context, I currently have 3 tables: 

  • School leaders (with profile fields that are pertinent to them)
  • Consultants (with profile fields that are specific to them)
  • Staff (internal staff who will need to login to add/edit info)

All 3 user groups above will need to login but they'll be given different menu options. I realized after attempting to create an Authentication that there can only be a single data source for the usernames and passwords, so it probably makes more sense to put all my different users into one table and then create views that specifically filter on my 3 types of users for my datapage needs?

 

 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1

Yes, you can create three different Views that filters the role for your user tables, then what I usually do are three different Authentications as well. This may lead to creating three DataPages.

But, feel free to take a look into this: https://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/

Or you may also try using the Record Level Security from the DataPages: https://howto.caspio.com/authentications-and-connections/authentication/record-level-security/

The key here is the creation of the proper distinguisher such as the Role field to determine the type of user that the authentication will be accepting. 

 

 

 

Link to comment
Share on other sites

  • 1

BAse on your workflow, all of them will be users with different roles. I suggest for this case that you just use a single table and mark each users depending by role. Then you can use the suggestion of @SinJunYoung to seperate them later via view with then with their own authentication.

The reason about this is because you may want to create a single login portal for them then just redirect them based on their user level. Even if each of the user levels has their own authentication and view, as long as their root table (which you will use as the data source of your authentication at the portal) is the same, you can automate the process by enabling the cross app login. 

If you put your users into different tables, you will have to make one login portal for each of them.  

Link to comment
Share on other sites

  • 1

@ClayG I am also using Weebly.

My workflow uses extra datapages, but my employees liked this way more than the others that we tried.

In Weebly, I made the same number of pages as Roles in my users table (One for Admin, PM, Office, Supervisor, and Employee). Then in Caspio, I used HTML Datapages to create 'dashboards' or specific navigation pages to list the datapages needed for each of the respected Roles. (I used Bootstrap and was able to make this look really good, but there are a ton of simple navbar templates you can use. I used iFrames in my navbar as I found it worked the best when deployed to Weebly.) So, the Caspio Admin page would get almost every datapage and the Employee level is very limited. The link below is a Caspio HowTo article that got me started on this.

https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/create-embeddable-tabbed-interface/

Then I took the embed deploy code of those HTML Page dashboards and embedded the code on their respective Weebly Role pages. I used Login Redirection to redirect all users to the correct Weebly page. 

When I first tried to just add the pages and create the Navbar in Weebly I found it ridiculously hard to make it look even somewhat good. Caspio and website builders are very finicky, Weebly is the best in my opinion but it still doesn't cooperate completely well. Doing the workflow above minimizes a lot of the work needed to have a presentable website. Also, making the Navbar be from Caspio made it so the Weebly navbar could hold pages for other things that all Roles should be able to see. In my case, I have all of my Caspio Datapages in the Caspio Navbar and things like News/Events and Safety Locations in the Weebly navbar. 

Kinda confusing. I'm not the best at describing solutions lol but if you need more help let me know!

Link to comment
Share on other sites

  • 0

Thank you both! I had planned to use the user-specific redirect after login, and I have it partially set up.

The thing I'm wrestling with now is wanting to use a website platform like Weebly to host the site. Since I want to have different menu options for an Admin vs a Regular user, I'm trying to figure out whether to create my menu options for the site in Weebly, but then use CSS to hide menus that a regular user should not see (which doesn't sound like a very security conscious way to go). Or, should I create my menu choices in Caspio using the App Parameters feature? That seems like a more security-minded approach and I have played with that a bit. 

This is my first significant app for me in Caspio. I've watched the videos from Ned who shows how he has hand-coded HTML pages for different users, and while that approach looks straight forward, I would really prefer to host the website with a nice CMS, like Weebly or Wordpress. 

Link to comment
Share on other sites

  • 0

No sir, I use one page for all users. I do not use Role in the authentication for these pages, so every active user can access them. Since it is likely that the login and update profile pages are the same fields for everyone (name, number, email, etc.) it can be used for everyone. However if you have extra fields for the roles, say maybe an Admin Code or something, you will need to create separate pages.

For pages where everyone can see everything, I usually just deploy them and use the URL to create links or buttons that either go straight to that page or open in a popup/new tab. Or, you could also use the Weebly navbar like I pointed out earlier to hold the pages that you need everyone to be able to access. 

Link to comment
Share on other sites

  • 0

Thanks, the part of this setup that I'm still pondering is how to handle a home page. Traditionally, a website's logo will be something that users can click to return to the home page. But when you're creating different landing pages for your roles, are you using some Javascript to change a home page link or logo to point to the user's landing page?

Link to comment
Share on other sites

  • 0

For anyone who reads this thread later.... I did find working code for Weebly websites for changing the home page href link of the logo (or site title) to point to the user's landing page, rather than the usual "/" home page URL. 

 

<!-- redirecting the logo to someplace else -->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(document).ready(function() {

$(".wsite-logo a").attr("href", "/admin-page.html"); 

});
</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...