+44(0)1908 545 770
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
09 December 2015

How to implement Role Base security for K2 SmartForms using Http Modules

How to implement Role Base security for K2 SmartForms

Usually, we will implement the security on each and every form to check user authorization.  In this article we will see how we can implement group level security trimming for all forms in one place.

K2 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

Step 1: Create Class Library
a) Create a classlibrary project with a class inheriting from IHttpModule
b) Add event handlers – in our case we added three events –  BeginRequest, PreRequestHandlerExecute, EndRequest

How to implement Role Base security for K2 SmartForms

c) Implement your logic in PreRequestHandlerExecute Event, in this event we can get access to read the Logged-In user details and requested pagename.

How to implement Role Base security for K2 SmartForms

d) Check the logged-in user groupname /Rolename using smartobjects
e) Check if the group has authorization to access the requested page by passing page name and group name.

How to implement Role Base security for K2 SmartForms

f) If the group doesn’t have permission to access the requested page, then page will get redirected to the default page.

How to implement Role Base security for K2 SmartForms

Step 2: Add ClassLibrary DLL to SmartForms Config File

a) Build the class library and do signing with strong naming key
b) Install DLL to GAC
c) Register ClassLibrary DLL in SmartForms runtime web.config file

How to implement Role Base security for K2 SmartForms

Now, the users from Contribute/ Visitors group can access only their allowed forms.

Also we can make the list of page URL’s as dynamic by defining in the database table or some other appropriate places that can be modified by administrator.

How to implement Role Base security for K2 SmartForms

Need further technical advice or support?