Skip to content
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

Group link invitation #6055

Closed
wants to merge 6 commits into from
Closed

Group link invitation #6055

wants to merge 6 commits into from

Conversation

awu0403
Copy link
Contributor

@awu0403 awu0403 commented May 7, 2024

No description provided.

@awu0403 awu0403 changed the title Invitation to join group link API completed Group link invitation May 7, 2024
@@ -344,6 +344,9 @@
re_path(r'^api/v2.1/groups/(?P<group_id>\d+)/members/(?P<email>[^/]+)/$', GroupMember.as_view(), name='api-v2.1-group-member'),
re_path(r'^api/v2.1/search-group/$', SearchGroup.as_view(), name='api-v2.1-search-group'),

re_path(r'^api/v2.1/groups/(?P<group_id>\d+)/invite-links/$', GroupInviteLinks.as_view(),name='api-v2.1-group-invite-links'),
re_path(r'^api/v2.1/groups/(?P<group_id>\d+)/invite-links/(?P<token>[-0-9a-f]{8})/$', GroupInviteLink.as_view(), name='api-v2.1-group-invite-link'),
re_path(r'^group-invite/(?P<token>[-0-9a-f]{8})/$', group_invite, name='group_invite'),
## address book
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group-invite 这个不要写在 api/v2.1/...的区域, 同时 group_invite view也不要写在 api 的endpoints里面, 放在group/view.py 文件里面

group = ccnet_api.get_group(group_id)
if MULTI_TENANCY:
error_msg = ' Multiple tenancy is not supported.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error_msg = ' Feature disabled.' 上面都是如此。
同时需要判断该group是群组还是部门

return api_error(status.HTTP_404_NOT_FOUND, error_msg)

if not is_group_owner_or_admin(group, email):
error_msg = 'Permission denied.'
Copy link
Contributor

@r350178982 r350178982 May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经有一个函数叫is_group_admin_or_owner可以使用, 不用重新定义该函数了


cache.set(key, nickname, NICKNAME_CACHE_TIMEOUT)
return nickname

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一段是干嘛用的?

@@ -472,6 +482,7 @@ class GroupView extends React.Component {
<ul className="sf-popover-list">
<li><a href="#" className="sf-popover-item" onClick={this.toggleImportMembersDialog} >{gettext('Import Members')}</a></li>
<li><a href="#" className="sf-popover-item" onClick={this.toggleManageMembersDialog} >{gettext('Manage Members')}</a></li>
<li><a href="#" className="sf-popover-item" onClick={this.toggleInviteMembersDialog} >{gettext('Invite Members')}</a></li>
</ul>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要判断是否是多租户,以及是否是部门,来进行显示

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新

@awu0403 awu0403 force-pushed the link-invite-to-join-group branch from eb9c726 to 67b96c8 Compare May 9, 2024 08:46
if group.creator_name == "system admin":
error_msg = ' Feature disabled.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forbidden to operate department group

@awu0403 awu0403 force-pushed the link-invite-to-join-group branch from 67b96c8 to f55ebfb Compare May 9, 2024 09:56
@freeplant freeplant deleted the branch 12.0 July 24, 2024 06:18
@freeplant freeplant closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants