Home/ASP.NET Forums/General ASP.NET/Data Scaffolding using ASP.NET Dynamic Data/Secure Dynamic Data Site

Secure Dynamic Data Site RSS

16 replies

Last post Feb 15, 2013 03:41 AM by mr41971

Dynamic Data Roles Permissions Security

See my blog C# Bits | Twitter @sjnaughton
Always seeking an elegant solution.
  • veloce

    veloce

    Member

    196 Points

    52 Posts

    Microsoft

    Re: Secure Dynamic Data Site

    Nov 07, 2008 07:07 PM|LINK

    Steve, I want to thank you for your remarks. Please, feel free to modify my example and let us know what you can come up with.

    Remember that the two basic design principles I adopted are as follows:

    1.      Use ASP.NET Forms Authentication to discriminate the user's roles.

    Everything you do in terms of authentication such as modify permissions, if I understand you correctly, must be integrated I believe with ASP.NET authentication mechanism.

    2.      Use ASP.NET Dynamic Data to authorize authenticated users to perform tasks at lower level, tasks only understood by Dynamic Data. Probably the centralization of field security should be done at this level. May be you can expand on this: I'm still looking into a way of centralizing the Field Security.

    Thanks,

    Michael (aka veloce)

     

    This posting is provided "AS IS" with no warranties, and confers no rights.


    I blog at: Technical Notes

  • sjnaughton

    sjnaughton

    All-Star

    27308 Points

    5458 Posts

    MVP

    Re: Secure Dynamic Data Site

    Nov 08, 2008 05:04 PM|LINK

    Yes I understand the principals have a look at this post Dynamic Data - Default FieldGenerator which I think could be the way forward for Field Security.

    [:D]

    Dynamic Data Attributes Based Permissions

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • mdausmann

    mdausmann

    Member

    2 Points

    2 Posts

    Re: Secure Dynamic Data Site

    Jul 11, 2009 02:38 AM|LINK

    Hi

    Thanks heaps for sample, I have implemented on my site and it works ok.  I had a couple of questions.

    Delete is only available for the role tagged as 'administrator' How would I go about allowing other user roles to have delete access on certain tables?  I tried adding the 'Delete' action in attributes but it didn't work.

    [Security(Role = "Anonymous", Action = "AnonymousList")]
    [Security(Role = "Developer", Action = "List")]
    [Security(Role = "Developer", Action = "Details")]
    [Security(Role = "Rule Author", Action = "List")]
    [Security(Role = "Rule Author", Action = "Details")]
    [Security(Role = "Rule Author", Action = "Edit")]
    [Security(Role = "Rule Author", Action = "Delete")]
    public partial class BehaviourDocument
    {

    }

    Michael

  • sjnaughton

    sjnaughton

    All-Star

    27308 Points

    5458 Posts

    MVP

    Re: Secure Dynamic Data Site

    Jul 11, 2009 08:43 AM|LINK

     Hi Mdausmann, I'll have a look at my sample and get back you.

    Dynamic Data

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • sjnaughton

    sjnaughton

    All-Star

    27308 Points

    5458 Posts

    MVP

    Re: Secure Dynamic Data Site

    Jul 11, 2009 09:02 AM|LINK

     Hi Mdausmann, in this sample from Veloce, you have to be admin to get delete facility you will need to look at the test on each page e.g. List page:

    // Enable delete button only to allowed users.
    private void SetDelete(TableRow row)
    {
        // Instantiate the SecurityInformation
        // utility object.
        DynamicDataSecurity secInfo =
          new DynamicDataSecurity();
    
    
        foreach (Control c in row.Cells[0].Controls)
        {
            // Deny delete capability to users that are
            // not administrators
            if (!secInfo.IsUserInAdmimistrativeRole() &&
              secInfo.IsUserInAuthenticatedRole())
            {
                // Do not allow delete.
                LinkButton btn = c as LinkButton;
                if (btn != null &&
                    btn.CommandName ==
                    DataControlCommands.DeleteCommandName)
                {
                    btn.Visible = false;
                    btn.OnClientClick = null;
                    btn.Enabled = false;
                }
            }
        }
    }

    if you note the statement:

    if (!secInfo.IsUserInAdmimistrativeRole() &&
              secInfo.IsUserInAuthenticatedRole())
    


    you will need to change the !secInfo.IsUserInAdmimistrativeRole() to some other test the will test that will check for a role with delete.

    Hope that makes sense [:D]

    Dynamic Data Securing Dynamic Data

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • zzdfc

    zzdfc

    Member

    142 Points

    149 Posts

    Re: Secure Dynamic Data Site

    Jul 12, 2009 02:32 PM|LINK

    The example of a Secure Dynamic Data Site Use CustomDynamicDataRouteHandler to achieve security,but how to transport data of session to CustomDynamicDataRouteHandler? I need transport custom logined user infomation to CustomDynamicDataRouteHandler.

    Thanks.

  • sjnaughton

    sjnaughton

    All-Star

    27308 Points

    5458 Posts

    MVP

    Re: Secure Dynamic Data Site

    Jul 12, 2009 03:16 PM|LINK

     Hi Zzdfc, I'm working on a simplified sample based on Veloces work, I should have part 1 ready early this week.

    Dynamic Data Securing Dynamic Data

    See my blog C# Bits | Twitter @sjnaughton
    Always seeking an elegant solution.
  • zzdfc

    zzdfc

    Member

    142 Points

    149 Posts

    Re: Secure Dynamic Data Site

    Jul 14, 2009 01:41 PM|LINK

     Hi sjnaughton:

           I have read your article "Securing Dynamic Data Preview 4 Refresh – Part 1",but it don't demo how to transport  session data to CustomDynamicDataRouteHandler? I need transport custom logined user infomation to CustomDynamicDataRouteHandler,example:

    Roles 、Permissions  and orgnization of the logined user.

  • Prev Next
    1 2Last

    ‹ Previous Thread|Next Thread ›