本文整理汇总了C#中UserId类的典型用法代码示例。如果您正苦于以下问题:C# UserId类的具体用法?C# UserId怎么用?C# UserId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserId类属于命名空间,在下文中一共展示了UserId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Authorize
public void Authorize(UserId user, object message)
{
var decider = GetDeciderForMessage(user);
if (!decider.AreAllAllowed(_resolver.ResolvePermission(message))) {
throw new SecurityException(string.Format("Yo bro, u do not have permission to {0}", message.GetType().Name.ToLowerInvariant()));
}
}
示例2: GetUserTimeline
public static IObservable<StatusCollection> GetUserTimeline(
this TwitterAccount account,
UserId? userId = null,
int? count = null,
StatusId? sinceId = null,
StatusId? maxId = null,
bool? trimUser = null,
bool? excludeReplies = null,
bool? contributorDetails = null,
bool? includeRts = null,
bool isStartup = false)
{
const string endpoint = "statuses/user_timeline";
var source = isStartup
? StatusSource.RestApi | StatusSource.Startup
: StatusSource.RestApi;
var client = account.ToOAuthClient(endpoint);
if (userId.HasValue) client.Parameters.Add("user_id", userId.Value);
if (count.HasValue) client.Parameters.Add("count", count.Value);
if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value);
if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value);
if (trimUser.HasValue) client.Parameters.Add("trim_user", trimUser.Value);
if (excludeReplies.HasValue) client.Parameters.Add("exclude_replies", excludeReplies.Value);
if (contributorDetails.HasValue) client.Parameters.Add("contributor_details", contributorDetails.Value);
if (includeRts.HasValue) client.Parameters.Add("include_rts", includeRts.Value);
return Observable
.Defer(client.GetResponseText)
.Select(json => StatusCollection.Parse(json, source))
.OnErrorRetry(3)
.WriteLine(endpoint);
}
示例3: Invite
public Invite(string email, string displayName, UserId userId, string token)
{
Email = email;
DisplayName = displayName;
FutureUserId = userId;
FutureToken = token;
}
示例4: GetUser
public User GetUser(UserId userId)
{
Guard.IsTrue("userId", () => userId.ToString().Length>0);
var request = AsanaRequest.Get(string.Format("users/{0}", userId));
return ExecuteRequest<User>(request);
}
示例5: Create
public void Create(UserId userId, SecurityId securityId)
{
if (_state.Version != 0)
throw new DomainError("User already has non-zero version");
Apply(new UserCreated(userId, securityId, DefaultLoginActivityThreshold));
}
示例6: GetDeciderForMessage
IAccessDecider GetDeciderForMessage(UserId userId)
{
var combinator = new AccessDecisionCombinator();
var user = _userRepository.Get(userId);
user.CombineDecisions(combinator, _roleRepository);
return combinator.BuildDecider();
}
示例7: PerformIdentityAuth
public AuthenticationResult PerformIdentityAuth(string identity)
{
long userId;
var logins = _webEndpoint.GetSingleton<LoginsIndexView>().Identities;
if (!logins.TryGetValue(identity, out userId))
{
// login not found
return AuthenticationResult.UnknownIdentity;
}
var id = new UserId(userId);
var maybe = _webEndpoint.GetView<LoginView>(id);
if (!maybe.HasValue)
{
// we haven't created view, yet
return AuthenticationResult.UnknownIdentity;
}
var view = maybe.Value;
// ok, the view is locked.
if (view.LockedOutTillUtc > DateTime.UtcNow.AddSeconds(2))
{
return new AuthenticationResult(ComposeLockoutMessage(view));
}
// direct conversion, will be updated to hashes
ReportLoginSuccess(id, view);
return ViewToResult(id, view);
}
示例8:
public List this[ListId id, UserId ownerId]
{
get
{
var key = Tuple.Create(id, ownerId);
return this.DoReadLockAction(() => this.lists.ContainsKey(key) ? this.lists[key] : null);
}
}
示例9: AddIdentity
public void AddIdentity(IDomainIdentityService ids, PasswordGenerator pwds, string display, string identity)
{
if (_state.ContainsIdentity(identity))
return;
var user = new UserId(ids.GetId());
var token = pwds.CreateToken();
Apply(new SecurityIdentityAdded(_state.Id, user, display, identity, token));
}
示例10: SetFallbackToken
public void SetFallbackToken(UserId userId, Guid applicationId)
{
this.fallbackToken = null;
this.FallbackUserId = userId;
this.FallbackApplicationId = applicationId;
this.RaisePropertyChanged("FallbackToken");
}
示例11: User
public User(InMemoryDomainEvents domainEvents, UserId id, string name, string email)
: base(domainEvents)
{
Id = id;
Name = name;
_email = email;
TryRaiseEvent(new UserCreated() { UserId = Id, UserName = Name, UserEmail = Email, Version = Version });
}
示例12: UpdateLogin
public void UpdateLogin(UserId id, DateTime timeUtc)
{
var item = Items[id.Id];
if (item.LastLoginUtc < timeUtc)
{
item.LastLoginUtc = timeUtc;
}
}
示例13: ShowListCore
private static IObservable<List> ShowListCore(OAuthClient client, string endpoint, UserId ownerId)
{
return Observable
.Defer(() => client.GetResponseText())
.Select(json => List.Parse(json, ownerId))
.OnErrorRetry(3)
.WriteLine(endpoint, list => list.FullName);
}
示例14: VkontakteLogin
public ActionResult VkontakteLogin(string uid, string firstName, string lastName, string photo, string returnUrl)
{
var userId = new UserId(uid);
_bus.Send(new ReportUserLoggedIn(userId, firstName + " " + lastName, photo));
FormsAuthentication.SetAuthCookie(uid, true);
return SuccessfullLoginRedirect(returnUrl);
}
示例15: SetUserEmailIfNeeded
private void SetUserEmailIfNeeded(UserId userId, EmailAddress email)
{
UserDetails userDetails = _readModel.GetUserDetails(userId);
if (String.IsNullOrWhiteSpace(userDetails.Email))
{
_bus.Send(new SetUserEmail(userId, email));
}
}