(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. Dynamic Widget Loading Based on User Roles
Nov 18
dynamic-widget-loading-based-on-user-roles

Dynamic Widget Loading Based on User Roles

  • November 18, 2016

A cloud based lending platform was developed for small business lenders by vteam #397. In the lending system, there were multiple user roles for example Manager, Sales Person, Referral Source and Business Development Officer etc. Each of these user roles had permissions for widgets specific to the respective role.

Requirement

A Dashboard (screen) was developed for managers and individuals to view their own performance as well as that of their subordinate’s. The main requirement was to display only those widgets for which the user in question had permission.

Note: A widget can be displayed in multiple ways be it a grid view, list view, some sections on the screen or a chart.

Initially the screen was developed to load all the widgets, and then hide the widgets for which the user did not have permissions. It met the basic requirement but was not the ideal solution. Let’s say, there were total 10 widgets and the user had permission to view only 2 of those 10. The remaining 8 widgets were loading unnecessarily.

The client’s requirement was to load only those widgets for which the specific user had permissions instead of redundantly loading all widgets and then hiding the rest.

Implementation

In order to load widgets dynamically based on user permissions, vteams engineers Umer Muhammad and Zeeshan Iqbal had to break each widget’s HTML template and their relevant JavaScript in separate files.

At first, each widget was separated one by one and organized in relevant folders. The directory structure for the widgets was as follows (Note: Highlighted folders are the individual widgets):

dynamic-widget-loading-based-on-user-roles-1

After splitting each widget, an API was developed to return the name of each widget based on user roles and permissions. After receiving the required widget name; the widgets were loaded using RequireJS. Below is the code snippet used to load widgets dynamically:

dynamic-widget-loading-based-on-user-roles-2

Conclusion

As a result, only the required widgets were loaded and significantly improved the system’s performance. Unnecessary calls and data fetching were avoided for extra widgets. Also, splitting widgets into separate files enhanced code maintainability.

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (490)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (56)
  • Implementation Notes (148)
  • Learn More (156)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development
  • Are Agile and DevOps the same?
  • The Data Scientist’s Toolset

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com