本文整理汇总了C#中UserId类的典型用法代码示例。如果您正苦于以下问题:C# UserId类的具体用法?C# UserId怎么用?C# UserId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserId类属于命名空间,在下文中一共展示了UserId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()));
}
}
开发者ID:yreynhout,项目名称:NAuthorize,代码行数:7,代码来源:MessageAuthorizer.cs
示例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);
}
开发者ID:Grabacr07,项目名称:Mukyutter.Old,代码行数:33,代码来源:RestApi_Timelines.cs
示例3: Invite
public Invite(string email, string displayName, UserId userId, string token)
{
Email = email;
DisplayName = displayName;
FutureUserId = userId;
FutureToken = token;
}
开发者ID:mojamcpds,项目名称:lokad-cqrs-1,代码行数:7,代码来源:SecurityState.cs
示例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);
}
开发者ID:pocheptsov,项目名称:nasana,代码行数:7,代码来源:AsanaClient.User.cs
示例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));
}
开发者ID:AGiorgetti,项目名称:lokad-cqrs,代码行数:7,代码来源:UserAggregate.cs
示例6: GetDeciderForMessage
IAccessDecider GetDeciderForMessage(UserId userId)
{
var combinator = new AccessDecisionCombinator();
var user = _userRepository.Get(userId);
user.CombineDecisions(combinator, _roleRepository);
return combinator.BuildDecider();
}
开发者ID:yreynhout,项目名称:NAuthorize,代码行数:7,代码来源:MessageAuthorizer.cs
示例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);
}
开发者ID:syned,项目名称:lokad-cqrs-appharbor,代码行数:32,代码来源:WebAuth.cs
示例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);
}
}
开发者ID:Grabacr07,项目名称:Mukyutter.Old,代码行数:8,代码来源:ListStore.cs
示例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));
}
开发者ID:mojamcpds,项目名称:lokad-cqrs-1,代码行数:8,代码来源:SecurityAggregate.cs
示例10: SetFallbackToken
public void SetFallbackToken(UserId userId, Guid applicationId)
{
this.fallbackToken = null;
this.FallbackUserId = userId;
this.FallbackApplicationId = applicationId;
this.RaisePropertyChanged("FallbackToken");
}
开发者ID:Grabacr07,项目名称:Mukyutter.Old,代码行数:8,代码来源:TwitterToken.cs
示例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 });
}
开发者ID:dgmachado,项目名称:EventSourcingAndCQRSLib,代码行数:8,代码来源:User.cs
示例12: UpdateLogin
public void UpdateLogin(UserId id, DateTime timeUtc)
{
var item = Items[id.Id];
if (item.LastLoginUtc < timeUtc)
{
item.LastLoginUtc = timeUtc;
}
}
开发者ID:JeetKunDoug,项目名称:lokad-cqrs,代码行数:8,代码来源:SecurityView.cs
示例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);
}
开发者ID:Grabacr07,项目名称:Mukyutter.Old,代码行数:8,代码来源:RestApi_Lists.cs
示例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);
}
开发者ID:AlexSugak,项目名称:EComWithCQRS,代码行数:8,代码来源:AccountController.cs
示例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));
}
}
开发者ID:MaximShishov,项目名称:EComWithCQRS,代码行数:9,代码来源:AccountController.cs
示例16: UpdateDisplayName
public void UpdateDisplayName(UserId userId, string displayName)
{
var user = _state.GetUser(userId);
if (user.DisplayName == displayName)
return;
Apply(new SecurityItemDisplayNameUpdated(_state.Id, userId, displayName));
}
开发者ID:AGiorgetti,项目名称:lokad-cqrs,代码行数:9,代码来源:SecurityAggregate.cs
示例17: ShowList
public static IObservable<List> ShowList(this TwitterAccount account, UserId owner, string slug)
{
const string endpoint = "lists/show";
var client = account.ToOAuthClient(endpoint);
client.Parameters.Add("slug", slug);
client.Parameters.Add("owner_id", owner);
return ShowListCore(client, endpoint, account.UserId);
}
开发者ID:Grabacr07,项目名称:Mukyutter.Old,代码行数:9,代码来源:RestApi_Lists.cs
示例18: GetFileName
/// <summary>
/// Gets the file name of the given user id.
/// </summary>
/// <param name="userId">the user id.</param>
/// <returns>the file name.</returns>
static string GetFileName(UserId userId)
{
if (userId == UserId.User1)
return @"Assets\Data\User1Contacts.xml";
else if (userId == UserId.User2)
return @"Assets\Data\User2Contacts.xml";
else
throw new NotSupportedException($"{userId} is not supported");
}
开发者ID:dtomovdimitrov,项目名称:Tangible,代码行数:14,代码来源:DataLoader.cs
示例19: GetUser
public AccountManagement.User GetUser(UserId userId)
{
using (var db = new THCard()) {
Guid userIdAsGuid = userId.ToGuid();
User dbUser = db.Users.SingleOrDefault(u => u.UserId == userIdAsGuid);
AccountManagement.User user = MapToUser(dbUser);
return user;
}
}
开发者ID:rgavrilov,项目名称:thcard,代码行数:9,代码来源:UserRepository.cs
示例20: AddItem
public void AddItem(UserId userId, SecurityItemType type, string displayName, string value)
{
Items[userId.Id] = new SecurityItem
{
Display = displayName,
Type = type,
Value = value,
UserId = userId.Id
};
}
开发者ID:JeetKunDoug,项目名称:lokad-cqrs,代码行数:10,代码来源:SecurityView.cs
注:本文中的UserId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论