Solved

Field security -- ASP.Net MVC 4 C#

Posted on 2013-06-20
3
529 Views
Last Modified: 2013-07-03
I am using ASP.Net MVC 4 C# Simple Membership.

What easy add-on/etc can I get make the
below View/Index.cshtml coding easier ?

Summary
 1. Index.cshtml page has 100+ textboxes
 2. each textbox has one of the below options
    depending on record's WorkFlowStage
    and logged in user's role
       ** Hidden
       ** ReadOnly --> below DisplayFor
       ** ReadWrite --> below EditorFor
------------------------------------------------
            @if(item.WorkFlowStage == '2')
            {
                if (User.IsInRole("BUICK_Inspector"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }

            @if(item.WorkFlowStage == '3')
            {
                if (User.IsInRole("BUICK_Tech"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }
0
Comment
Question by:finance_teacher
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 39267440
Hi,

You can try Fluent Security - http://www.fluentsecurity.net/

Hope it helps u...
0
 

Author Comment

by:finance_teacher
ID: 39292872
I emailed fluentsecurity.net and they said their premade solution does not do this.

Any other ideas ?
0
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 500 total points
ID: 39294285
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question