AuthorizeProjectUser() public static method

public static AuthorizeProjectUser ( int projectId ) : void
projectId int
return void
        public static void AuthorizeProjectUser(int[] projectIds)
        {
            var userId =
                ((IBusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;

            ProjectUserRepository.AuthorizeProjectUser(projectIds, userId);
        }
Ejemplo n.º 2
0
        public static StatusInfoList StatusFetchInfoList(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            return(StatusInfoList.FetchStatusInfoList(
                       new StatusDataCriteria
            {
                ProjectId = projectId
            }));
        }
        public static ProjectUserInfoList ProjectUserFetchInfoList(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            return(ProjectUserInfoList.FetchProjectUserInfoList(
                       new ProjectUserMemberDataCriteria
            {
                ProjectId = projectId
            }));
        }
Ejemplo n.º 4
0
        public static SprintInfoList SprintFetchInfoList(IProject project)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            return(SprintInfoList.FetchSprintInfoList(
                       new SprintDataCriteria
            {
                ProjectId = new[] { project.ProjectId }
            }));
        }
Ejemplo n.º 5
0
        public static StoryInfoList StoryFetchInfoList(ISprint sprint)
        {
            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            return(StoryInfoList.FetchStoryInfoList(
                       new StoryDataCriteria
            {
                ProjectId = new[] { sprint.ProjectId },
                SprintId = sprint.SprintId
            }));
        }
Ejemplo n.º 6
0
        public static StoryInfoList StoryFetchInfoList(IProject project, bool?isArchived)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            return(StoryInfoList.FetchStoryInfoList(
                       new StoryDataCriteria
            {
                ProjectId = new[] { project.ProjectId },
                IsArchived = isArchived
            }));
        }
Ejemplo n.º 7
0
        public static SprintInfoList SprintFetchInfoList(IProject[] projects, bool?isArchived)
        {
            var projectIds = projects.Select(row => row.ProjectId).ToArray();

            ProjectUserRepository.AuthorizeProjectUser(projectIds);

            return(SprintInfoList.FetchSprintInfoList(
                       new SprintDataCriteria
            {
                ProjectId = projectIds,
                IsArchived = isArchived
            }));
        }
Ejemplo n.º 8
0
        public static bool SprintDelete(Sprint sprint)
        {
            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            Sprint.DeleteSprint(
                new SprintDataCriteria
            {
                SprintId = sprint.SprintId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, sprint);

            return(true);
        }
Ejemplo n.º 9
0
        public static Project ProjectFetch(int projectId)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectId);

            var result = Project.FetchProject(
                new ProjectDataCriteria
            {
                ProjectId = projectId
            });

            result.Auditor = new ProjectAuditor(result.Clone());

            return(result);
        }
Ejemplo n.º 10
0
        public static bool StoryDelete(Story story)
        {
            ProjectUserRepository.AuthorizeProjectUser(story.ProjectId);

            Story.DeleteStory(
                new StoryDataCriteria
            {
                StoryId = story.StoryId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, story);

            return(true);
        }
Ejemplo n.º 11
0
        public static bool ProjectDelete(Project project)
        {
            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            Project.DeleteProject(
                new ProjectDataCriteria
            {
                ProjectId = project.ProjectId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, project);

            return(true);
        }
Ejemplo n.º 12
0
        public static Project ProjectUpdate(Project project)
        {
            if (!project.IsDirty)
            {
                return(project);
            }

            ProjectUserRepository.AuthorizeProjectUser(project.ProjectId);

            project = project.Save();

            SourceRepository.SourceUpdate(project.ProjectId, SourceType.Project, project.Name);

            FeedRepository.FeedAdd(FeedAction.Edited, project);

            return(project);
        }
Ejemplo n.º 13
0
        public static Status StatusUpdate(Status status)
        {
            if (!status.IsDirty)
            {
                return(status);
            }

            ProjectUserRepository.AuthorizeProjectUser(status.ProjectId);

            status = status.Save();

            SourceRepository.SourceUpdate(status.StatusId, SourceType.Status, status.Name);

            FeedRepository.FeedAdd(FeedAction.Edited, status);

            return(status);
        }
        public static bool ProjectUserDelete(ProjectUser projectUser)
        {
            ProjectUserRepository.AuthorizeProjectUser(projectUser.ProjectId);

            if (ProjectUserRepository.ProjectUserFetch(
                    projectUser.ProjectId, projectUser.UserId).RoleId == (int)Role.Owner)
            {
                throw new NotSupportedException("You cannot delete the owner of a project");
            }

            ProjectUser.DeleteProjectUser(
                new ProjectUserMemberDataCriteria
            {
                ProjectUserMemberId = projectUser.ProjectUserMemberId
            });

            FeedRepository.FeedAdd(FeedAction.Deleted, projectUser);

            return(true);
        }
Ejemplo n.º 15
0
        public static Sprint SprintSave(Sprint sprint)
        {
            if (!sprint.IsValid)
            {
                return(sprint);
            }

            ProjectUserRepository.AuthorizeProjectUser(sprint.ProjectId);

            Sprint result;

            if (sprint.IsNew)
            {
                result = SprintRepository.SprintInsert(sprint);
            }
            else
            {
                result = SprintRepository.SprintUpdate(sprint);
            }

            return(result);
        }
        public static ProjectUser ProjectUserSave(ProjectUser projectUser)
        {
            if (!projectUser.IsValid)
            {
                return(projectUser);
            }

            ProjectUserRepository.AuthorizeProjectUser(projectUser.ProjectId);

            ProjectUser result;

            if (projectUser.IsNew)
            {
                result = ProjectUserRepository.ProjectUserInsert(projectUser);
            }
            else
            {
                result = ProjectUserRepository.ProjectUserUpdate(projectUser);
            }

            return(result);
        }
Ejemplo n.º 17
0
        public static Story StorySave(Story story)
        {
            if (!story.IsValid)
            {
                return(story);
            }

            ProjectUserRepository.AuthorizeProjectUser(story.ProjectId);

            Story result;

            if (story.IsNew)
            {
                result = StoryRepository.StoryInsert(story);
            }
            else
            {
                result = StoryRepository.StoryUpdate(story);
            }

            return(result);
        }