How to Create Users, Roles and Permissions in a LightSwitch Forms Authentication Application



Prologue:

In this article we shall discuss how to create Users, Roles, and Permissions and how to set Permissions to Roles and Roles to Users.

Publishing the Application:

We have discussed how to publish the LightSwitch Desktop Forms Authentication application for an end user machine in my previous article.

While publishing the application, of course we need to create an administrator account to login after installation.

After successful installation of the application we can create users, roles and permissions.


LightSwitch1.gif

Ensure the successful install of our application. You can see the FormsAuthendicationInLS icon in Windows start menu. Just click it and login as administrator.

Let us discuss creating Users, Roles and Permissions step by step.

Creating Users:

When you have logged in as Administrator you will have access to the Users and Roles screens.


LightSwitch2.gif

From the left side panel we select the Users menu from the Administrator main menu. This Users screen will display a screen which allows the administrator to create users. By default the administrator user details will be there.


LightSwitch3.gif

As shown in the above figure the administrator can create users. The steps to create users are:

  1. Click "+" like button to add a User [No: 1].
  2. Enter the details like username, user fullname, password and confirm password as shown in [No: 2].
  3. Click on the Save button which is in the left top corner of the application.
  4. Then the username and the users fullname will be displyed in the Users list.

Creating Roles:

Now that we have created the user we are ready to create Roles for the user.


LightSwitch4.gif

Select the "Roles" from the Administrator menu. This Roles menu will display the Roles screen which allows you to create Roles for Users.


LightSwitch5.gif

The Rules Screens allows the Administrator to create the Roles for Users.

Here are the Steps to create Roles.
  1. Click on "+" like button which is under the heading "Roles" to create a Role
    [No: 1].
  2. On click of "+" button it will prompt to Role name. Enter the Roles name as like Administrator [No: 2].
  3. Save the Role.

Assigning Permissions to Roles:

As we have created the Permissions at the time of Project development [in Project properties] let's now assign the Permissions to Roles.


LightSwitch6.gif

Permissions can be assigned from the Roles screen itself. Follow the steps given below.
  1. Click on "+" like button which is under the heading "Permissions" to creating the Permissions. [No: 3]
  2. Select the Permissions from Permission dropdown box [No: 4].
  3. Repeat the step 1 to create more permission.
  4. Save the permission.

Assigning the Roles to Users:

We are ready with Users, Roles and Permissions. Let's see how to assign the Permission to Roles.

First we shall assign the Role to user "jagan". The following are the steps to Proceed.
  1. Select the User "jagan" from Users list [No: 1].
  2. Click on "+" like button which is under the heading Roles to add the Roles to User [No: 2].
  3. Select the Roles from Role Dropdown list [No: 3].
  4. Repeat the step from 1 if you need to more roles to the selected User.

You are now done with creating Users, Roles and Permissions.

Run the Application and logon with a different user and see the permissions given you.

Summary:

In this article, we have seen how to create Users, Roles and Permissions for LightSwitch Desktop application with Forms Authentication.
Thanks for spending your precious time here. Please provide your valuable feedbacks and comments, which enable me to give a better article the next time.
 
Please rate this Article.

Thanks.

Up Next
    Ebook Download
    View all
    Learn
    View all