Video Synopsis



  • Ned Pajic, Technical Evangelist, Caspio



Ned Pajic: Welcome back. My name is Ned. I am a technical evangelist at Caspio. And in this ultimate video guide, I will teach you how to develop an expense reporting application using Caspio’s Low Code Visual Application Builder. In part three, I will teach you how to set up user level permissions using views and authentications. Let’s take a look.

Leveraging the Views Object

Now that we have all of our tables created, let’s learn how we can leverage the views object to filter out employees based on their user role. So let’s go into the views and I’ll need to create a total of six views. Five views are going to be used to filter based on their user role field. And the sixth view is going to be a join between two tables. We’re going to merge the user’s table or the employee’s table with the expenses table. And you’ll see how we use that view later on once we build our forms and reports.

Filtering Active Employees

For now, let’s set up our very first view and let’s give this view a name. We’re going to call this ER for expense reporting underscore, and I’m going to call this all active employees. This view is going to filter everybody from the user table that’s active. Why do we wanna do that? Because when we build a login screen later on, we want all of these employees to have access to the same data pages. If you think of a change password form, all employees within this table should be able to access this form to be able to change the password. So let’s select our employee table, move it to the right, click next. And then using the criteria tab, all you need to do is move this field element to the right and then select the field account status and have that be checked.

If this condition is true, if the account status check box is checked, this view is now going to filter everybody from your table who’s checked. And as you can see at the moment, all the users in my table have the account status checked. This is the reason why the view is filtering all of them as active users. Let’s go back up to the views menu.

Filtering Out Admins

The next view that I’m going to create is the one that filters out admins because some reports and some forms can only be accessed by the admin level user. So let’s include our employee table to the right. Let’s give it a name, ER, admin access, and let’s move on to the subsequent screen. Again, using the criteria tab this time you want to insert this element twice, choose the field user role and then have the value equal to admin. But since we’re looking for active admins, we also want the account status check box to be selected, checked. And now if both of these two conditions are true, if user equals to admin, and if the account status is checked, this view is going to filter out our CEO who happens to be John Davis. Back out to the views menu.

Filtering Out Active Admins and Active Managers

The next view that I’m going to create is the one that filters out active admins and active managers. The reason why is because sometimes you might have forms and reports that need to be accessed by both the admin level user and a manager. So we’ll call this ER, admin manager access. Once again from the employee table, hit next, go into the criteria tab. And this one is set up a little bit differently. We’re going to use an or operator, insert two fields inside it. You can see they snap in place like Lego pieces and then one more down below. So now we want to field user role to equal to admin, or we want the same user role field to equal to manager, but we want an account status to be checked. So now when I click finish, this view is going to filter out anybody who is a manager or admin and is active user in my employee table.

Filtering Out HR Employees

Let’s set up our fourth view. And fourth view, let’s go ahead and filter out ER, HR access from the same employee table, click next, criteria tab, move the field element to the right, select the user role to equal to HR. And since we’re looking for active HR account status to be checked. HR will have its own login portal because as an HR user, I should be able to have more privileges and be able to see more company data, to be able to approve everyone’s expense or reject it. So that’s how we create a separate login screen or separate view to filter out just the HR employees. Let’s click finish. In my table there is one HR user. So it’s going to filter out Sarah Hicks. She is an HR employee. Back out to views.

Filtering Out Users

Let’s set up our last view to filter out users. And the last one here, we’re going to call ER manager access because sometimes a manager of a certain department will be able to see certain forms and reports that nobody else will be able to see. Once again from the employee table, move it to the right, click next. And then using the criteria tab, let’s go ahead and select a user role field equals to manager, and we want them to be active from within the table. And now this view is going to filter out anybody who’s a manager and is active. There is one more view left to create, but we’re going to build this view in part four of the ultimate video guide, because it’s going to make more sense. Once we start building our forms and reports as to why we need to use that view.

Building Authentications

For now, let’s just focus on authentications and creating these user permissions. Once you’re done with all five of these views, the next thing to do is to go down to the authentications object. And however many views you’ve created, you’re going to need to build that many authentications as well. So let’s begin with our very first authentication. And when you click on this dropdown for data source, you’re going to find all five of your views. And you’re going to repeat this process five different times. So let’s begin with the admin access. Click on custom for your setup option.

And then how do you wanna validate the user that’s logging into the application? Let’s use the Caspio data source, which is the view that we have selected up here. Scroll down a little bit. You’re going to find your email and password fields. Go ahead and rename the label to say email and then expand the advanced settings below. And down here, you’re going to find something called logout destination, click on change, go to a new page and input your destination URL. In other words, when the application user logs out, where do you wanna redirect that user to? And typically you’re going to send them back to the login interface. Now this is going to be my URL. You’re going to have your own webpage. So just build that webpage where you plan on embedding your login screen, and that’s going to be your destination URL. Click save. Let’s do the same thing for timeout and redirection, and let’s have the user be automatically redirected, if they’re away from their computer for one week. Go to a new page, paste the URL and click save. And the last thing that we wanna do here is enable cross application login, click on create, and let’s call this ER, admin login. So just repeat the process four more times. I’m going to show you one more time. New authentication, select the second view, custom, recommended, email. And let’s go ahead and input our destination URLs in the advanced settings. Enable cross app login and click on create, and let’s call it ER, admin manager login. I have quickly populated the remaining authentication. So when you’re done on your side, you should be able to see something like this as well.

Creating Folders

The final step that I wanna show you before we start developing all the forms and reports is to navigate over to data pages object, and to create folders. Folders are going to be used to manage all of the data pages. In other words, all of the interfaces and however many different authentications you have, you should also create folders for each one of those authentications. So let’s build our admin folder. Let’s create admin and manager.

We’re going to call one all access, HR, and last but not least, we’re going to have a manager folder. This concludes our video on how to set up the views to filter out based on the user role field. How to create the authentications. This way we’re giving access to certain individuals to certain functionality. And finally, we learn how to build the folders that are going to contain all of the interfaces. Thank you for watching. And I hope to see in the next video where I begin to show you how to build all the forms, all the reports, all the workflows that this application is going to need. I’ll see you there.

Next Steps

See why low-code developers are growing 3x faster than traditional developers.
Have a vision for an application? Talk to a Caspio product expert and we’ll help you achieve it.
Want to see if Caspio is a good fit for your needs? Choose a date and time for a personalized demo.