/// <summary>
        /// Adds access to the all users for the given document
        /// </summary>
        /// <param name="organizationUnitId">Organization unit id</param>
        /// <param name="documentId">Unique document id</param>
        /// <param name="fileStructureId">Unique filestructure id</param>
        /// <param name="fileStructurePathId">Unique path id</param>
        /// <param name="configuration">Unique path id</param>
        /// <param name="organizationUnitId">Workflow state</param>
        public void SetOrganizationUnitAcess(Guid organizationUnitId, Guid documentId, DocumentWorkflowConfiguration configuration)
        {
            bool accessChanged = false;

            var userAssignments = workflowOrganizationUnitUserAssignmentRepository.GetForOrganizationByConfigurationId(configuration.Guid, organizationUnitId);
            var access          = authorizationService.GetAccessRights("IT_Document", "Guid", documentId);

            if (access == null)
            {
                return;
            }

            if (userAssignments == null || !userAssignments.Any())
            {
                return;
            }

            if (access.UserFullAccess == null)
            {
                access.UserFullAccess = new List <int>();
            }

            foreach (var assignment in userAssignments)
            {
                if (!access.UserFullAccess.Contains(assignment.UserId))
                {
                    access.UserFullAccess.Add(assignment.UserId);
                    accessChanged = true;
                }
            }

            if (accessChanged)
            {
                authorizationService.SetAccess("IT_Document", "Guid", documentId, access);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Gets all user assignments for a specific workflow and organization
 /// </summary>
 /// <param name="workflowConfigurationId">Unique workflow id</param>
 /// <param name="organizationUnitId">Unique organization id</param>
 /// <returns>List of user-assignments</returns>
 public IEnumerable <WorkflowOrganizationUnitUserAssignment> GetForOrganizationByConfigurationId(Guid workflowConfigurationId, Guid organizationUnitId)
 {
     return(workflowOrganizationUnitUserAssignmentRepository.GetForOrganizationByConfigurationId(workflowConfigurationId, organizationUnitId));
 }