public void RefreshLock(string token, int timeout, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Lock")) { if (this.Locked && this.LockToken == token) { _node.LastLockUpdate = DateTime.Now; _node.LockTimeout = timeout; _node.Save(versionRaising, VersionStatus.Locked); //****Log Logger.WriteVerbose("NodeLock is refreshed." // message , new Dictionary <string, object>() { { "Id", Node.Id }, { "Path", Node.Path } } // properties ); } else { if (Locked) { throw new LockedNodeException(this, "Node is locked but passed locktoken is invalid."); } else { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } } traceOperation.IsSuccessful = true; } }
public void Unlock(string token, VersionStatus versionStatus, VersionRaising versionRaising) { using (var op = SnTrace.ContentOperation.StartOperation("Node.LockHandler.Unlock: NodeId:{0}, VersionId:{1}, Version:{2}, VersionRaising:{3}, Locktoken:{4}.", _node.Id, _node.VersionId, _node.Version, versionRaising, token)) { if (Locked && this.LockToken == token) { _node.LockedById = 0; _node.LockToken = string.Empty; _node.LockTimeout = 0; _node.LockDate = new DateTime(1800, 1, 1); _node.LastLockUpdate = new DateTime(1800, 1, 1); _node.LockType = 0; _node.Save(versionRaising, versionStatus); } else { if (Locked) { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } else { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } } op.Successful = true; } }
public void RefreshLock(string token, int timeout, VersionRaising versionRaising) { using (var op = SnTrace.ContentOperation.StartOperation("Node.LockHandler.RefreshLock: NodeId:{0}, VersionId:{1}, Version:{2}, VersionRaising:{3}, Locktoken:{4}, Timeout:{5}." , _node.Id, _node.VersionId, _node.Version, versionRaising, token, timeout)) { if (this.Locked && this.LockToken == token) { _node.LastLockUpdate = DateTime.UtcNow; _node.LockTimeout = timeout; _node.Save(versionRaising, VersionStatus.Locked); } else { if (Locked) { throw new LockedNodeException(this, "Node is locked but passed locktoken is invalid."); } else { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } } op.Successful = true; } }
public void Unlock(VersionStatus versionStatus, VersionRaising versionRaising) { if (this.LockedBy.Id != AccessProvider.Current.GetCurrentUser().Id) { this.Node.Security.Assert("Node is locked by another user", PermissionType.ForceCheckin); } this.Unlock(this.LockToken, versionStatus, versionRaising); }
public void Unlock(VersionStatus versionStatus, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Unlock")) { if (this.LockedBy.Id != AccessProvider.Current.GetCurrentUser().Id) { this.Node.Security.Assert("Node is locked by another user", PermissionType.ForceCheckin); } this.Unlock(this.LockToken, versionStatus, versionRaising); traceOperation.IsSuccessful = true; } }
public void RefreshLock(int timeout, VersionRaising versionRaising) { IUser lockUser = this.LockedBy; if (lockUser.Id == AccessProvider.Current.GetCurrentUser().Id) { RefreshLock(this.LockToken, timeout, versionRaising); } else { throw new SenseNetSecurityException(this.Node.Id, "Node is locked by another user"); } }
public void RefreshLock(int timeout, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Lock")) { IUser lockUser = this.LockedBy; if (lockUser.Id == AccessProvider.Current.GetCurrentUser().Id) { RefreshLock(this.LockToken, timeout, versionRaising); } else { throw new SenseNetSecurityException(this.Node.Id, "Node is locked by another user"); } traceOperation.IsSuccessful = true; } }
public void Lock(int timeout, VersionRaising versionRaising) { using (var op = SnTrace.ContentOperation.StartOperation("Node.LockHandler.Lock: NodeId:{0}, VersionId:{1}, Version:{2}, VersionRaising:{3}, Timeout:{4}.", _node.Id, _node.VersionId, _node.Version, versionRaising, timeout)) { if (!this.Locked) { _node.LockToken = Guid.NewGuid().ToString(); _node.LockedById = AccessProvider.Current.GetCurrentUser().Id; _node.LockDate = DateTime.UtcNow; _node.LastLockUpdate = DateTime.UtcNow; _node.LockTimeout = timeout; _node.Save(versionRaising, VersionStatus.Locked); } else { RefreshLock(versionRaising); } op.Successful = true; } }
public void Lock(int timeout, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Lock")) { if (!this.Locked) { _node.LockToken = Guid.NewGuid().ToString(); _node.LockedById = AccessProvider.Current.GetCurrentUser().Id; _node.LockDate = DateTime.Now; _node.LastLockUpdate = DateTime.Now; _node.LockTimeout = timeout; _node.Save(versionRaising, VersionStatus.Locked); } else { RefreshLock(versionRaising); } //****Log Logger.WriteVerbose("Node is locked.", Logger.GetDefaultProperties, this); traceOperation.IsSuccessful = true; } }
public void Unlock(string token, VersionStatus versionStatus, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Unlock")) { if (Locked && this.LockToken == token) { _node.LockedById = 0; _node.LockToken = string.Empty; _node.LockTimeout = 0; _node.LockDate = new DateTime(1800, 1, 1); _node.LastLockUpdate = new DateTime(1800, 1, 1); _node.LockType = 0; _node.Save(versionRaising, versionStatus); //****Log Logger.WriteVerbose("Node lock is released." // message , new Dictionary <string, object>() { { "Id", Node.Id }, { "Path", Node.Path } } // properties ); } else { if (Locked) { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } else { throw new LockedNodeException(this, "Node is not locked or lock timed out"); } } traceOperation.IsSuccessful = true; } }
public void Lock(VersionRaising versionRaising) { Lock(DefaultLockTimeOut, versionRaising); }
public void RefreshLock(int timeout, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Lock")) { IUser lockUser = this.LockedBy; if (lockUser.Id == AccessProvider.Current.GetCurrentUser().Id) RefreshLock(this.LockToken, timeout, versionRaising); else throw new SenseNetSecurityException(this.Node.Id, "Node is locked by another user"); traceOperation.IsSuccessful = true; } }
public void RefreshLock(VersionRaising versionRaising) { RefreshLock(DefaultLockTimeOut, versionRaising); }
public void RefreshLock(string token, int timeout, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Lock")) { if (this.Locked && this.LockToken == token) { _node.LastLockUpdate = DateTime.Now; _node.LockTimeout = timeout; _node.Save(versionRaising, VersionStatus.Locked); //****Log Logger.WriteVerbose("NodeLock is refreshed." // message , new Dictionary<string, object>() { { "Id", Node.Id }, { "Path", Node.Path } } // properties ); } else { if (Locked) throw new LockedNodeException(this, "Node is locked but passed locktoken is invalid."); else throw new LockedNodeException(this, "Node is not locked or lock timed out"); } traceOperation.IsSuccessful = true; } }
public void Unlock(VersionStatus versionStatus, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Unlock")) { if(this.LockedBy.Id != AccessProvider.Current.GetCurrentUser().Id) this.Node.Security.Assert("Node is locked by another user", PermissionType.ForceCheckin); this.Unlock(this.LockToken, versionStatus, versionRaising); traceOperation.IsSuccessful = true; } }
public void Unlock(string token, VersionStatus versionStatus, VersionRaising versionRaising) { using (var traceOperation = Logger.TraceOperation("Node.LockHandler.Unlock")) { if (Locked && this.LockToken == token) { _node.LockedById = 0; _node.LockToken = string.Empty; _node.LockTimeout = 0; _node.LockDate = new DateTime(1800, 1, 1); _node.LastLockUpdate = new DateTime(1800, 1, 1); _node.LockType = 0; _node.Save(versionRaising, versionStatus); //****Log Logger.WriteVerbose("Node lock is released." // message , new Dictionary<string, object>() { { "Id", Node.Id }, { "Path", Node.Path } } // properties ); } else { if (Locked) throw new LockedNodeException(this, "Node is not locked or lock timed out"); else throw new LockedNodeException(this, "Node is not locked or lock timed out"); } traceOperation.IsSuccessful = true; } }
public void RefreshLock(VersionRaising versionRaising) { RefreshLock(RepositoryEnvironment.DefaultLockTimeout, versionRaising); }