27 from soc.logic import cleaning |
27 from soc.logic import cleaning |
28 from soc.logic import dicts |
28 from soc.logic import dicts |
29 from soc.logic import models as model_logic |
29 from soc.logic import models as model_logic |
30 from soc.logic.models import org_app as org_app_logic |
30 from soc.logic.models import org_app as org_app_logic |
31 from soc.views.helper import access |
31 from soc.views.helper import access |
|
32 from soc.views.helper import decorators |
32 from soc.views.helper import redirects |
33 from soc.views.helper import redirects |
33 from soc.views.models import group_app |
34 from soc.views.models import group_app |
34 from soc.views.models import program as program_view |
35 from soc.views.models import program as program_view |
35 |
36 |
36 import soc.logic.dicts |
37 import soc.logic.dicts |
46 |
47 |
47 Params: |
48 Params: |
48 params: a dict with params for this View |
49 params: a dict with params for this View |
49 """ |
50 """ |
50 |
51 |
51 #TODO(ljvderijk) do the right rights check |
|
52 rights = access.Checker(params) |
52 rights = access.Checker(params) |
53 rights['create'] = ['checkIsDeveloper'] |
53 rights['create'] = ['checkIsDeveloper'] |
54 rights['delete'] = [('checkCanEditGroupApp', |
54 rights['delete'] = [('checkCanEditGroupApp', |
55 [org_app_logic.logic])] |
55 [org_app_logic.logic]), |
|
56 ('checkIsActivePeriod', ['org_signup', 'scope_path'])] |
56 rights['edit'] = [('checkCanEditGroupApp', |
57 rights['edit'] = [('checkCanEditGroupApp', |
57 [org_app_logic.logic])] |
58 [org_app_logic.logic]), |
|
59 ('checkIsActivePeriod', ['org_signup', 'scope_path'])] |
58 rights['list'] = ['checkIsDeveloper'] |
60 rights['list'] = ['checkIsDeveloper'] |
59 rights['public'] = [('checkCanEditGroupApp', |
61 rights['public'] = [('checkCanEditGroupApp', |
60 [org_app_logic.logic])] |
62 [org_app_logic.logic])] |
61 rights['review'] = ['checkIsDeveloper', |
63 # TODO(ljvderijk) fix host access check |
|
64 rights['review'] = ['checkIsHostForProgram', |
62 ('checkCanReviewGroupApp', [org_app_logic.logic])] |
65 ('checkCanReviewGroupApp', [org_app_logic.logic])] |
|
66 rights['review_overview'] = ['checkIsDeveloper'] |
|
67 rights['apply'] = ['checkIsUser', |
|
68 ('checkCanCreateOrgApp', ['org_signup'])] |
63 |
69 |
64 new_params = {} |
70 new_params = {} |
65 |
71 |
66 new_params['rights'] = rights |
72 new_params['rights'] = rights |
67 new_params['logic'] = org_app_logic.logic |
73 new_params['logic'] = org_app_logic.logic |
68 |
74 |
69 new_params['scope_view'] = program_view |
75 new_params['scope_view'] = program_view |
70 new_params['scope_redirect'] = redirects.getCreateRedirect |
76 new_params['scope_redirect'] = redirects.getCreateRedirect |
71 |
77 |
72 new_params['sidebar_grouping'] = 'Organizations' |
78 new_params['sidebar_grouping'] = 'Organizations' |
|
79 |
|
80 patterns = [(r'^%(url_name)s/(?P<access_type>apply)/%(scope)s$', |
|
81 'soc.views.models.%(module_name)s.create', |
|
82 'Create an %(name_plural)s'),] |
|
83 |
|
84 new_params['extra_django_patterns'] = patterns |
73 |
85 |
74 new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status', |
86 new_params['extra_dynaexclude'] = ['applicant', 'backup_admin', 'status', |
75 'created_on', 'last_modified_on'] |
87 'created_on', 'last_modified_on'] |
76 |
88 |
77 new_params['create_extra_dynafields'] = { |
89 new_params['create_extra_dynafields'] = { |