package org.xcolab.view.pages.proposals.view.contest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import org.xcolab.view.pages.proposals.utils.context.ProposalContext;
import org.xcolab.view.pages.proposals.view.proposal.BaseProposalsController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller

public class ContestDiscussionController extends BaseProposalsController {

    @GetMapping("/contests/{contestYear}/{contestUrlName}/discussion")
    public String showContestProposals(HttpServletRequest request, HttpServletResponse response,
            Model model, ProposalContext proposalContext) {

        model.addAttribute("discussionId",  proposalContext.getContest().getDiscussionGroupId());
        setBasePageAttributes(proposalContext, model);
        return "proposals/contestDiscussion";
    }
}

@@ -195,16 +195,277 @@
 pping;%0A%0A
+import org.xcolab.client.admin.pojo.ContestType;%0Aimport org.xcolab.client.contest.pojo.Contest;%0Aimport org.xcolab.client.members.pojo.Member;%0Aimport org.xcolab.view.errors.AccessDeniedPage;%0Aimport org.xcolab.view.pages.proposals.permissions.ContestPermissions;%0A
 import o
@@ -526,16 +526,16 @@
 ontext;%0A
-
 import o
@@ -1016,11 +1016,388 @@
 text
-) %7B
+, Member loggedInMember) %7B%0A%0A        final Contest contest = proposalContext.getContest();%0A        final ContestType contestType = contest.getContestType();%0A        if (contestType.isRestrictedAccess() && !new ContestPermissions(loggedInMember)%0A                .getCanAccessContest(contest)) %7B%0A            return new AccessDeniedPage(loggedInMember).toViewName(response);%0A        %7D
 %0A%0A  

Add permissions to contest discussion