private void CheckAccess(string value) { UserAccessManager userAccessManager = WcfContext.Current.GetUserAccessManager(); OperationKey operationKey = this.GetOperationKey(value); if (operationKey == null) { throw new ArgumentException("Invalid operation key."); } if (!userAccessManager.CheckAccess(operationKey.SessionId)) { throw new AuthenticationException("Not login or login timeout."); } User user = userAccessManager.GetUser(operationKey.SessionId, true); if (!this.IsUserActive(user)) { throw new AuthenticationException(string.Format("The user (Serial:{0}) is {1}.", user.Serial, user.Status)); } Organization org = userAccessManager.GetOrganization(operationKey.SessionId); if (!this.IsOrganizationActive(org)) { throw new AuthenticationException(string.Format("The organization (Name:{0}) is {1}.", org.Name, org.Status)); } UserAccess access = userAccessManager.FindUserAccessItem(operationKey.SessionId); if (access == null) { throw new AuthenticationException("Cannot find login session."); } userAccessManager.KeepAlive(operationKey.SessionId); UserAccessInfo info = new UserAccessInfo { Organization = org, User = user, UserAccess = access }; WcfContext.Current.Set("UserAccessInfo", info); WcfContext.Current.Set("OperationKey", operationKey); }