Show / Hide Table of Contents

Class DocumentArchiveFileImpersonationContext

Helper class for impersonation.

Inheritance
object
DocumentArchiveFileImpersonationContext
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: SuperOffice.Security.Util
Assembly: SoCore.dll
Syntax
public sealed class DocumentArchiveFileImpersonationContext
Examples
new DocumentArchiveFileImpersonationContext().Execute(() => {
    // in here we are the correct user to access the document archive files, log folder etc
    // do something as the configured Document Archive user (if not configured the original NetServer user will be used).
});
// we are now back to the original NetServer user

This way of impersonation is guaranteed to return to the original user, also during exception handling - thereby avoiding a potential security hole.

Constructors

DocumentArchiveFileImpersonationContext()

Helper class for impersonation.

Declaration
public DocumentArchiveFileImpersonationContext()
Examples
new DocumentArchiveFileImpersonationContext().Execute(() => {
    // in here we are the correct user to access the document archive files, log folder etc
    // do something as the configured Document Archive user (if not configured the original NetServer user will be used).
});
// we are now back to the original NetServer user

This way of impersonation is guaranteed to return to the original user, also during exception handling - thereby avoiding a potential security hole.

Methods

Execute(Action)

Helper class for impersonation.

Declaration
public void Execute(Action action)
Parameters
Type Name Description
Action action
Examples
new DocumentArchiveFileImpersonationContext().Execute(() => {
    // in here we are the correct user to access the document archive files, log folder etc
    // do something as the configured Document Archive user (if not configured the original NetServer user will be used).
});
// we are now back to the original NetServer user

This way of impersonation is guaranteed to return to the original user, also during exception handling - thereby avoiding a potential security hole.

Execute(Func<Task>)

Helper class for impersonation.

Declaration
public Task Execute(Func<Task> action)
Parameters
Type Name Description
Func<Task> action
Returns
Type Description
Task
Examples
new DocumentArchiveFileImpersonationContext().Execute(() => {
    // in here we are the correct user to access the document archive files, log folder etc
    // do something as the configured Document Archive user (if not configured the original NetServer user will be used).
});
// we are now back to the original NetServer user

This way of impersonation is guaranteed to return to the original user, also during exception handling - thereby avoiding a potential security hole.

Execute<T>(Func<T>)

Helper class for impersonation.

Declaration
public T Execute<T>(Func<T> func)
Parameters
Type Name Description
Func<T> func
Returns
Type Description
T
Type Parameters
Name Description
T
Examples
new DocumentArchiveFileImpersonationContext().Execute(() => {
    // in here we are the correct user to access the document archive files, log folder etc
    // do something as the configured Document Archive user (if not configured the original NetServer user will be used).
});
// we are now back to the original NetServer user

This way of impersonation is guaranteed to return to the original user, also during exception handling - thereby avoiding a potential security hole.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top