Role Based Personalization

Discussion in 'ASP .Net' started by bradgatewood@insightbb.com, Mar 30, 2006.

  1. Guest

    I am in the process of developing a highly customizable application and
    I'm looking for a way to allow personalization by role. This is
    different than shared scope in the fact that I want to allow multiple
    clients to make modifications to properties, placement, controls on
    page, etc... and have all users see the customizations that apply to
    them. Customizations will take place at Client > Branch > Division
    levels. So when a user logs into the application I will retrieve keys
    for each level (ClientKey, BranchKey, DivisionKey) and based on those
    keys I will determine which customizations they see.

    I'm thinking to pull this off I will need to create a custom
    PersonalizationProvider and a custom WebPartPersonalization class to
    store the information in a slightly modified schema.

    thoughts?
     
    , Mar 30, 2006
    #1
    1. Advertising

  2. Bradgatewood,

    No why build a new entershared scope when the one you have will work with a
    little Yankee Enginuity?

    Heres a tested (yes it works) you get it done before lunch solution and the
    catalog controls work too! I guarantee you'll be the hero at work. Allow
    some users to entersharedscope but depending on their role you enable
    layoutchange only to certain webpartzones. You enable layout change to the
    branch manager webpartzone for users in the branch manager role. You enable
    layout change to the manager webpartzone for users in the manager role.
    Hopefully your getting this. Helpdesk and a few higher up people get layout
    change to all webpartzones.

    When you switch to an editing mode disable layoutchange in all webpartzones.
    Then selectivly enable layoutchange based on role in company. My test
    didn't use roles because well I'm web master and can do stuff like that. but
    you could substitute the isinroles method for the identity.name="dan" boolean
    test I used.

    Protected Sub btnAdmin_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles btnShared.Click
    If _m.Personalization.CanEnterSharedScope Then
    _m.Personalization.ToggleScope()
    End If
    End Sub

    'my enter edit mode button
    Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As
    System.Web.UI.ImageClickEventArgs) Handles btnEdit.Click
    entermode(WebPartManager.EditDisplayMode)
    End Sub

    #Region "WebpartHelpers"
    'Code to toggle a webpart displaymode between browse/mode
    Private Sub entermode(ByVal mode As WebParts.WebPartDisplayMode)
    'the IsEnabled function of webpartmanager checks the page
    'and the current page users authority to enter a mode.
    'If there is no editorzone on a page the page cannot enter edit mode.
    'if the current user has deny verbs="modifyState"
    'the current user can not enter editmode.
    dim _m as webpartmanager = webpartmanger.getcurrentwebpartmanager(page)
    If _m.DisplayMode.Name <> mode.Name _
    And _m.DisplayModes.Item(mode.Name).IsEnabled(_m) Then
    _m.DisplayMode = mode
    Else
    _m.DisplayMode = WebPartManager.BrowseDisplayMode
    End If

    'testing code for Ryan and limited sharedstate starts here
    'nine lines of code demo.
    If _m.DisplayMode.AllowPageDesign Then
    For Each z As WebPartZone In _m.Zones
    z.AllowLayoutChange = False
    Next
    If Page.User.Identity.Name = "dan" Then
    _m.Zones("F").AllowLayoutChange = True
    _m.Zones("Z1").AllowLayoutChange = True
    End If
    End If

    End Sub
    #End Region

    Good Luck
    DWS
    PS I'm going to incorporate this into my web site. So I can give some users
    limited ability to do shared personalization on the site thanks for the idea.

    Check out my webparts at www.dws400.com, Brand New real time javascript
    appearance editor I just made it last week. register and give it a whirl.
    Click the tree after you log in to enter edit mode.

    "" wrote:

    > I am in the process of developing a highly customizable application and
    > I'm looking for a way to allow personalization by role. This is
    > different than shared scope in the fact that I want to allow multiple
    > clients to make modifications to properties, placement, controls on
    > page, etc... and have all users see the customizations that apply to
    > them. Customizations will take place at Client > Branch > Division
    > levels. So when a user logs into the application I will retrieve keys
    > for each level (ClientKey, BranchKey, DivisionKey) and based on those
    > keys I will determine which customizations they see.
    >
    > I'm thinking to pull this off I will need to create a custom
    > PersonalizationProvider and a custom WebPartPersonalization class to
    > store the information in a slightly modified schema.
    >
    > thoughts?
    >
    >
     
    =?Utf-8?B?RFdT?=, Mar 31, 2006
    #2
    1. Advertising

  3. Guest

    Thanks for the feedback.
    I took a look at shared scope but my understanding of it is that when
    you make a change shared it applies to all users. One of my
    requirements was that a user only sees changes that are within their
    client, branch or division. Let me elaborate.

    1) User enters username and password
    2) Determine users role and retrieve user information
    3) Based on which client, role, division retrieve site customization
    for URL
    4) Apply custom look and feel, web part layout, etc...

    Each user will be in a role which then defines their place in the
    hierarchy. At each node the page could have different color schemes,
    text, fonts, images, etc... based on the theme applied and based on the
    customizations applied they could be displayed different web parts,
    have permission levels effected, etc..

    So really I need a solution that instead of using the ASPNET
    personalization schema and rendering customizations by user(s) I can
    specify which personalization to apply. So I would have my own
    structure for storing customizations and would want to retrieve them
    based on who logged in.

    Example:
    Key | ClientKey | BranchKey | DivKey | URL | PageSettings
    1 1234 123 12 2.aspx data
    2 1234 121 12 2.aspx data
    3 1634 125 11 2.aspx data

    So for user "Brad" I want to use Customization #1 but for user
    "Gatewood" I want #3
     
    , Mar 31, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jesper Stocholm
    Replies:
    2
    Views:
    8,117
    John Saunders
    Aug 23, 2003
  2. Liet Kynes
    Replies:
    0
    Views:
    495
    Liet Kynes
    Nov 26, 2003
  3. Electrified Research
    Replies:
    3
    Views:
    572
    Electrified Research
    Sep 23, 2006
  4. Larry Bud

    Should I use a Role or Personalization

    Larry Bud, Jun 26, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    355
    Peter Bradley
    Jun 26, 2007
  5. Kursat
    Replies:
    1
    Views:
    320
    Dominick Baier
    May 7, 2007
Loading...

Share This Page