Beispiel #1
0
        public async Task <List <SubArtifact> > GetSubArtifactTreeAsync(int artifactId)
        {
            var userId      = Session.UserId;
            var artifactIds = new[] { artifactId };
            var permissions = await _artifactPermissionsRepository.GetArtifactPermissions(artifactIds, userId, false);

            RolePermissions permission;

            if (!permissions.TryGetValue(artifactId, out permission) || !permission.HasFlag(RolePermissions.Read))
            {
                throw new HttpResponseException(HttpStatusCode.Forbidden);
            }
            return((await _artifactRepository.GetSubArtifactTreeAsync(artifactId, userId)).ToList());
        }