BExIS.Security.Services.Authorization.PermissionManager.ExistsDataPermission C# (CSharp) Метод

ExistsDataPermission() публичный Метод

public ExistsDataPermission ( IEnumerable subjectIds, long entityId, long dataId, RightType rightType ) : bool
subjectIds IEnumerable
entityId long
dataId long
rightType RightType
Результат bool
        public bool ExistsDataPermission(IEnumerable<long> subjectIds, long entityId, long dataId, RightType rightType)
        {
            if (DataPermissionsRepo.Query(p => subjectIds.Contains(p.Subject.Id) && p.Entity.Id == entityId && p.DataId == dataId && p.RightType == rightType).Count() > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

Same methods

PermissionManager::ExistsDataPermission ( long subjectId, long entityId, long dataId, RightType rightType ) : bool

Usage Example

Пример #1
0
        public ActionResult Datasets_Select()
        {
            DatasetManager datasetManager = new DatasetManager();
            PermissionManager permissionManager = new PermissionManager();
            SubjectManager subjectManager = new SubjectManager();

            // DATA
            //var ids = datasetManager.GetDatasetLatestIds();
            List<DatasetVersion> data = datasetManager.GetDatasetLatestVersions(); // .GetDatasetLatestVersions(ids);

            List<DatasetGridRowModel> datasets = new List<DatasetGridRowModel>();
            data.ForEach(d => datasets.Add(DatasetGridRowModel.Convert(d, permissionManager.ExistsDataPermission(subjectManager.GetGroupByName("everyone").Id, 1, d.Id, RightType.View))));

            return View(new GridModel<DatasetGridRowModel> { Data = datasets });
        }