-
Notifications
You must be signed in to change notification settings - Fork 95
fix group permission issue (No. 307, 312~326) #1931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -517,7 +517,7 @@ def can_invite_others(self, user): | |
| return False | ||
| elif self.is_admin(user): | ||
| return True | ||
| elif self.subscription_policy != SubscriptionPolicy.CLOSED: | ||
| elif self.subscription_policy == SubscriptionPolicy.OPEN: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.325, 326 |
||
| return True | ||
| else: | ||
| return False | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,9 @@ | |
| from six.moves.urllib.parse import urlparse | ||
| from sqlalchemy.exc import IntegrityError | ||
| from invenio_db import db | ||
| from weko_accounts.utils import roles_required | ||
| from weko_admin.config import WEKO_ADMIN_PERMISSION_ROLE_REPO, \ | ||
| WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY | ||
|
|
||
| from .forms import GroupForm, NewMemberForm | ||
| from .models import Group, Membership | ||
|
|
@@ -116,6 +119,7 @@ def groupcount(): | |
|
|
||
|
|
||
| @blueprint.route('/grouplist', methods=['GET']) | ||
| @login_required | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.307 |
||
| def grouplist(): | ||
| """ | ||
| Get logined group list info. | ||
|
|
@@ -210,6 +214,9 @@ def invitations(): | |
| @blueprint.route('/new', methods=['GET', 'POST']) | ||
| @register_breadcrumb(blueprint, 'breadcrumbs.settings.group.new', _('New')) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.312, 313 |
||
| def new(): | ||
| """ | ||
| Create new group. | ||
|
|
@@ -250,6 +257,9 @@ def new(): | |
| {'text': _('Manage')}] | ||
| ) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.314, 315, 316, 317 |
||
| def manage(group_id): | ||
| """ | ||
| Manage your group. | ||
|
|
@@ -294,6 +304,9 @@ def manage(group_id): | |
|
|
||
| @blueprint.route('/<int:group_id>/delete', methods=['POST']) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.318 |
||
| def delete(group_id): | ||
| """ | ||
| Delete group. | ||
|
|
@@ -328,6 +341,9 @@ def delete(group_id): | |
|
|
||
| @blueprint.route('/<int:group_id>/members', methods=['GET', 'POST']) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.319 |
||
| @register_breadcrumb( | ||
| blueprint, 'breadcrumbs.settings.group.members', _('Members'), | ||
| dynamic_list_constructor=lambda: | ||
|
|
@@ -417,6 +433,9 @@ def leave(group_id): | |
| @blueprint.route('/<int:group_id>/members/<int:user_id>/approve', | ||
| methods=['POST']) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.321 |
||
| def approve(group_id, user_id): | ||
| """ | ||
| Approve a user. | ||
|
|
@@ -455,6 +474,9 @@ def approve(group_id, user_id): | |
| @blueprint.route('/<int:group_id>/members/<int:user_id>/remove', | ||
| methods=['POST']) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.322 |
||
| def remove(group_id, user_id): | ||
| """ | ||
| Remove user from a group. | ||
|
|
@@ -549,6 +571,9 @@ def reject(group_id): | |
|
|
||
| @blueprint.route('/<int:group_id>/members/new', methods=['GET', 'POST']) | ||
| @login_required | ||
| @roles_required([WEKO_ADMIN_PERMISSION_ROLE_SYSTEM, | ||
| WEKO_ADMIN_PERMISSION_ROLE_REPO, | ||
| WEKO_ADMIN_PERMISSION_ROLE_COMMUNITY]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix no.325, 326 |
||
| @register_breadcrumb( | ||
| blueprint, | ||
| 'breadcrumbs.settings.newmember', | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.