public virtual void Impersonate(IActor actor, ImpersonationMode mode) { if (actor != null) { actor.HasHead = false; } }
public override void Impersonate(IActor actor, ImpersonationMode mode) { base.Impersonate(actor, mode); SyncCameras(); LockTarget = actor; LockMode = mode; Recenter(); }
public override void Impersonate(IActor actor, ImpersonationMode mode) { base.Impersonate(actor, mode); MoveToPosition(actor.Eyes.position, actor.Eyes.rotation, mode == ImpersonationMode.Approximately); }
private void Init(bool appLevel, bool throwOnError) { if (_configKnown) { return; } lock (this) { if (_configKnown) { return; } if (HttpRuntime.ConfigInited) { IdentityConfig settings = null; IntPtr tokenToReadConfig = IntPtr.Zero; if (_context != null && HttpRuntime.IsOnUNCShareInternal && !_inProgress) { // when reading config on UNC share we have to impersonate around it // note: we are getting config here to figure out the impersonation mode tokenToReadConfig = _context._wr.GetUserToken(); UnsafeNativeMethods.SetThreadToken(IntPtr.Zero, tokenToReadConfig); } try { try { using (new HttpContextWrapper(_context)) { // getting config might require current context if (appLevel || _context == null) { if (s_appIdentityConfig != null) { settings = s_appIdentityConfig; } else { settings = (IdentityConfig)HttpContext.GetAppConfig("system.web/identity"); s_appIdentityConfig = settings; } } else { settings = (IdentityConfig)_context.GetConfig("system.web/identity"); } } } catch { if (throwOnError) { throw; } } finally { if (tokenToReadConfig != IntPtr.Zero) { UnsafeNativeMethods.RevertToSelf(); } } } catch { // Protect against exception filters throw; } if (settings != null) { if (settings.EnableImpersonation) { if (settings.ImpersonateToken != IntPtr.Zero) { _mode = ImpersonationMode.Application; _token = settings.ImpersonateToken; } else if (_context != null) { _mode = ImpersonationMode.Client; _token = _context._wr.GetUserToken(); } } else { _mode = ImpersonationMode.None; _token = IntPtr.Zero; } } // don't remember app level setting with context if (!appLevel) { _configKnown = true; } } // UNC impersonation overrides everything but Application credentials // it is in effect event before config system gets initialized if (_context != null && HttpRuntime.IsOnUNCShareInternal && _mode != ImpersonationMode.Application) { _mode = ImpersonationMode.UNC; if (_token == IntPtr.Zero) { _token = _context._wr.GetUserToken(); } } } }