Role Based Personalization

B

bradgatewood

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?
 
G

Guest

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.
 
B

bradgatewood

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top