예제 #1
0
        /// <inheritdoc />
        public IEnumerable <RolePermission> FindBy(string extensionName_, Common.Enums.Permission level_)
        {
            var data = from rolePermisson in storageContext.Set <RolePermission>()
                       join permission in storageContext.Set <Permission>() on rolePermisson.PermissionId equals permission.Id
                       join identityRoles in storageContext.Set <IdentityRole <string> >() on rolePermisson.RoleId equals identityRoles.Id
                       where rolePermisson.Extension == extensionName_ && permission.Name == level_.GetPermissionName()
                       select new RolePermission
            {
                Extension = rolePermisson.Extension,
                RoleId    = rolePermisson.RoleId,
                Id        = rolePermisson.Id,
                Role      = new IdentityRole <string>(identityRoles.Name)
                {
                    Id = identityRoles.Id, NormalizedName = identityRoles.NormalizedName
                },
                PermissionId = rolePermisson.PermissionId
            };

            return(data.ToList());
        }
예제 #2
0
        /// <inheritdoc />
        public IEnumerable <UserPermission> FindBy(string extensionName_, Common.Enums.Permission level_)
        {
            var data = from userPermission in storageContext.Set <UserPermission>()
                       join permission in storageContext.Set <Permission>() on userPermission.PermissionId equals permission.Id
                       where userPermission.Extension == extensionName_ && permission.Name == level_.GetPermissionName()
                       select userPermission;

            return(data.ToList());
        }