Solved

Field security -- ASP.Net MVC 4 C#

Posted on 2013-06-20
3
524 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now