Access rights for profile properties.

M

MikeS

Is there a way to make certain profile properties writable to only
users in a certain role?
Like allow/deny tags on the property definition. Or some attribute to
be placed on a property of a custom profile objects properties the way
SettingsAllowAnonymousAttribute is? I could use something like
SettingsWriteDemandRole("Admin"). Or a way to lock out writes to a
property in a custom provider based on the current users role?
 
M

MikeS

It looks like you can't just add a PrincipalPermissionAttribute on a
setter in just any old class stuffed into profile properties.

I got it to work by having the profile inherit from my class which in
turn inherits from ProfileBase and used the attribute there.

<profile defaultProvider="MyProfileProvider" inherits="MyProfileBase">
....
Public Class MyProfileBase
Inherits ProfileBase
....
<PrincipalPermissionAttribute(SecurityAction.Demand,
Role:="Admin")> _
Set(ByVal value As String)
MyBase.SetPropertyValue("PropertyName", value)

The small problem I have with this now is that other classes added to
the profile properties in goups seem to not be accesible.
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top