Re: Impersonation
From: Bradford Ray (nospam_at_hotmail.com)
Date: 09/24/04
- Next message: Pete Cole: "Re: AlternateHeader not used by AllItems.aspx"
- Previous message: marcus.kellermann_at_gmail.com: "WebPart Implementing both IParametersOutProvider and IParametersOutConsumer"
- In reply to: JNathan: "Re: Impersonation"
- Next in thread: Roland Whitmyre: "Re: Impersonation"
- Reply: Roland Whitmyre: "Re: Impersonation"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 14:37:01 +0100
Hi Jay, thanks for looking at my post!
Yes, the admin impersonation took place in a web part. The impersonation
seems to work, and windows knows there is a 'new' user, but Sharepoint
doesn't? (The login box only appears when I try to do anything with
Sharepoint)
I have also tried changing the HttpContext and using it to get an SPWeb
object, but it still doesn't see the impersonated user.
Any ideas?
"JNathan" <jay.nathan@mariner-usa.com> wrote in message
news:bb7f1799.0409240408.7b24b2e@posting.google.com...
> The SharePoint object model still isn't aware of the context change,
> and to me, this is almost a shortcoming of the SharePoint object model
> (but there may be a compelling reason that it is this way). When you
> say that you have successfully impersonated the admin user and created
> local accounts, did you do that within a Web Part in SharePoint?
>
>
>
> "Bradford Ray" <nospam@hotmail.com> wrote in message
news:<#R4Io1jmEHA.3756@TK2MSFTNGP09.phx.gbl>...
> > Update: I have just successfully Impersonated the administrator to
create
> > local windows accounts using DirectoryServices, so I know the
Impersonation
> > works on some level...
> >
> > It seems Sharepoint isn't being updated with the new user information?
> >
> >
> >
> > "Bradford Ray" <nospam@hotmail.com> wrote in message
> > news:%23UcNCTjmEHA.3876@TK2MSFTNGP15.phx.gbl...
> > > Hi,
> > >
> > > I'm having an identity crisis. I am using Jay Nathan's Impersonator
class
> > to
> > > try impersonate an administrator, which seems to be working except
that
> > > Sharepoint doesn't know that the user has changed.
> > >
> > > To try explain what I mean, this is what gets returned AFTER I call
> > > .Impersonate():
> > > System.Security.Principal.WindowsIdentity.GetCurrent.Name returns the
> > > adminstrator;
> > > Environment.UserName returns the administrator;
> > > Initially context.User.Identity.Name is incorrect, but then if I set
the
> > > context.User to use the new Identity (with New ...GenericPrincipal),
it
> > > shows the User to be the administrator;
> > > SPControl.GetContextWeb(context).CurrentUser.LoginName stills shows
the
> > > non-administrative user (I call this after I have changed the context
> > > object);
> > >
> > > I am not sure if any of those is significant (for all I know the
SPUser
> > > shouldn't change), but what I do know is that when a "Reader" user
runs my
> > > code they get a login box because of insufficient permissions. The
login
> > > shows when I call .Update() on a restricted SPListItem - commenting
out
> > that
> > > line doesn't bring up a login box, so I'm sure the Impersonation isn't
> > > throwing errors.
> > >
> > > Our site is in test, so I've changed the web.config's trust level to
Full
> > > which means I haven't made any changes to any Sharepoint
...trust.config
> > > files.
> > >
> > > Basically, any ideas? From what I've seen I'm not doing anything too
> > > differently from Jay Nathans stuff, or even from MSDN's event handler
> > > example which also uses Impersonation.
> > >
> > > Cheers,
> > > Brad.
> > >
> > >
- Next message: Pete Cole: "Re: AlternateHeader not used by AllItems.aspx"
- Previous message: marcus.kellermann_at_gmail.com: "WebPart Implementing both IParametersOutProvider and IParametersOutConsumer"
- In reply to: JNathan: "Re: Impersonation"
- Next in thread: Roland Whitmyre: "Re: Impersonation"
- Reply: Roland Whitmyre: "Re: Impersonation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|