コード例 #1
0
        public void Ensure(SecurityEntityTypes entityType, SecurityMethods method)
        {
            string rightToCheck        = GetDummyRightName(entityType, method);
            string currentIdentityName = this.GetCurrentIdentityName();

            if (!this.dummyUserRights.ContainsKey(currentIdentityName) ||
                !this.dummyUserRights[currentIdentityName].Contains(rightToCheck))
            {
                throw new SecurityException();
            }
        }
コード例 #2
0
        /// <summary>
        /// Lists blogs.
        /// </summary>
        /// <param name="ownerType">The owner type.</param>
        /// <param name="owner">The owner identifier.</param>
        /// <param name="q">The query arguments.</param>
        /// <param name="cancellationToken">The optional token to monitor for cancellation requests.</param>
        /// <returns>The collection of result.</returns>
        public async Task <IEnumerable <BlogEntity> > ListBlogsAsync(SecurityEntityTypes ownerType, string owner, QueryArgs q, CancellationToken cancellationToken = default)
        {
            var t = (int)ownerType;

            return(await GetContext(true).Blogs.ListEntities(q, ele => ele.OwnerId == owner && ele.OwnerTypeCode == t).ToListAsync(cancellationToken));
        }
コード例 #3
0
 private static string GetDummyRightName(SecurityEntityTypes entityType, SecurityMethods method) => $"{Enum.GetName(entityType.GetType(), entityType)}_{Enum.GetName(method.GetType(), method)}";
コード例 #4
0
ファイル: NoSecurityService.cs プロジェクト: pandadoudou/Owt
 public void Ensure(SecurityEntityTypes contact, SecurityMethods create)
 {
 }
コード例 #5
0
 /// <summary>
 /// Gets a client credential by app identifier.
 /// </summary>
 /// <param name="provider">The provider name or url.</param>
 /// <param name="ownerType">The owner type.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <param name="cancellationToken">The optional token to monitor for cancellation requests.</param>
 /// <returns>The user entity matched if found; otherwise, null.</returns>
 public Task <IEnumerable <AuthorizationCodeEntity> > GetAuthorizationCodesByOwnerAsync(string provider, SecurityEntityTypes ownerType, string ownerId, CancellationToken cancellationToken = default)
 {
     return(ToListAsync(GetAuthorizationCodesByOwner(provider, ownerType, ownerId), cancellationToken));
 }
コード例 #6
0
 /// <summary>
 /// Gets a client credential by app identifier.
 /// </summary>
 /// <param name="provider">The provider name or url.</param>
 /// <param name="ownerType">The owner type.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <returns>The user entity matched if found; otherwise, null.</returns>
 public IEnumerable <AuthorizationCodeEntity> GetAuthorizationCodesByOwner(string provider, SecurityEntityTypes ownerType, string ownerId)
 {
     return(codes.Where(ele => ele.OwnerId == ownerId && ele.OwnerType == ownerType));
 }
コード例 #7
0
 /// <summary>
 /// Lists blogs.
 /// </summary>
 /// <param name="ownerType">The owner type.</param>
 /// <param name="owner">The owner identifier.</param>
 /// <param name="q">The query arguments.</param>
 /// <param name="cancellationToken">The optional token to monitor for cancellation requests.</param>
 /// <returns>The collection of result.</returns>
 public override async Task <IEnumerable <BlogEntity> > ListBlogsAsync(SecurityEntityTypes ownerType, string owner, QueryArgs q, CancellationToken cancellationToken = default)
 {
     return(await DataProvider.ListBlogsAsync(ownerType, owner, q, cancellationToken));
 }
コード例 #8
0
 /// <summary>
 /// Gets a client credential by app identifier.
 /// </summary>
 /// <param name="provider">The provider name or url.</param>
 /// <param name="ownerType">The owner type.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <returns>The user entity matched if found; otherwise, null.</returns>
 IEnumerable <AuthorizationCodeEntity> IAccountDataProvider.GetAuthorizationCodesByOwner(string provider, SecurityEntityTypes ownerType, string ownerId)
 {
     return(GetAuthorizationCodesByOwner(provider, ownerType, ownerId));
 }
コード例 #9
0
 /// <summary>
 /// Gets a client credential by app identifier.
 /// </summary>
 /// <param name="provider">The provider name or url.</param>
 /// <param name="ownerType">The owner type.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <returns>The user entity matched if found; otherwise, null.</returns>
 public IQueryable <AuthorizationCodeEntity> GetAuthorizationCodesByOwner(string provider, SecurityEntityTypes ownerType, string ownerId)
 {
     return(GetContext(true).Codes.Where(ele => ele.OwnerId == ownerId && ele.OwnerTypeCode == (int)ownerType && ele.ServiceProvider == provider));
 }