ЖизниЛЕНТА

Copyright © 2007 Шапель Павел

Archive for the ‘impersonation’ tag

Sharepoint Security and .NET Impersonation2

without comments

В продолжении поста Sharepoint Security and .NET Impersonation, WSA нашёл пример в MSDN по выполнению определённого кода под повышенными правами (под SHAREPOINT\System account identity)

SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() {
  using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID)) {
    using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID)) {
      string SiteCollectionOwner = ElevatedsiteColl.Owner.Name;
      string Visits = ElevatedsiteColl.Usage.Visits.ToString();
      string RootAuditEntries =
          ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString();
    }
  }
});

По-сути данный код делает тоже, что и наш самописный.

Written by Pash

Октябрь 30th, 2007 at 7:12 пп

Sharepoint Security and .NET Impersonation

without comments

Для использования имперсонализации для всякого рода нужд в рамках SharePoint-а необходимо знать некоторые, не совсем очевидные, хитрости.

Хозяйке на заметку:
Impersonation is the ability of a thread to execute in a security context that is different from the context of the process that owns the thread.

Read the rest of this entry »

Written by Pash

Октябрь 30th, 2007 at 1:15 пп