51 |
51 |
52 Params: |
52 Params: |
53 params: a dict with params for this View |
53 params: a dict with params for this View |
54 """ |
54 """ |
55 |
55 |
56 # TODO(ljvderijk) Access checks for different views |
|
57 rights = access.Checker(params) |
56 rights = access.Checker(params) |
58 rights['create'] = ['checkIsDeveloper'] |
57 rights['create'] = ['checkIsDeveloper'] |
59 rights['edit'] = ['checkIsDeveloper'] |
58 rights['edit'] = [('checkCanStudentPropose', 'scope_path'), |
|
59 ('checkRoleAndStatusForStudentProposal', |
|
60 [['proposer'], ['active'], ['new', 'pending']])] |
60 rights['delete'] = ['checkIsDeveloper'] |
61 rights['delete'] = ['checkIsDeveloper'] |
61 # TODO(ljvderijk) public should be host/org/student only |
62 rights['show'] = [ |
62 rights['public'] = ['checkIsDeveloper'] |
63 ('checkRoleAndStatusForStudentProposal', |
|
64 [['proposer', 'org_admin', 'mentor', 'host'], |
|
65 ['active', 'inactive'], ['new', 'pending', 'accepted', 'rejected']])] |
63 rights['list'] = ['checkIsDeveloper'] |
66 rights['list'] = ['checkIsDeveloper'] |
64 rights['apply'] = ['checkIsDeveloper'] |
67 rights['apply'] = [ |
|
68 ('checkIsStudent', ['scope_path', ['active']]), |
|
69 ('checkCanStudentPropose', 'scope_path')] |
65 |
70 |
66 new_params = {} |
71 new_params = {} |
67 new_params['logic'] = soc.logic.models.student_proposal.logic |
72 new_params['logic'] = soc.logic.models.student_proposal.logic |
68 new_params['rights'] = rights |
73 new_params['rights'] = rights |
69 new_params['name'] = "Student Proposal" |
74 new_params['name'] = "Student Proposal" |
103 'organization': forms.CharField(label='Organization Link ID', |
108 'organization': forms.CharField(label='Organization Link ID', |
104 widget=widgets.ReadOnlyInput), |
109 widget=widgets.ReadOnlyInput), |
105 'link_id': forms.CharField(widget=forms.HiddenInput) |
110 'link_id': forms.CharField(widget=forms.HiddenInput) |
106 } |
111 } |
107 |
112 |
108 # TODO(ljvderijk) students should be able to withdraw their proposal |
113 # TODO(ljvderijk) students should be able to withdraw their proposals |
109 |
114 |
110 params = dicts.merge(params, new_params) |
115 params = dicts.merge(params, new_params) |
111 |
116 |
112 super(View, self).__init__(params=params) |
117 super(View, self).__init__(params=params) |
113 |
118 |