Skip to content

Commit

Permalink
an inactive user shouldn't be able to be a collaborator
Browse files Browse the repository at this point in the history
  • Loading branch information
adelowo committed Jul 28, 2018
1 parent a74426d commit cbf4c92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ settings.transfer_succeed = The repository has been transferred.
settings.confirm_delete = Delete Repository
settings.add_collaborator = Add Collaborator
settings.add_collaborator_success = The collaborator has been added.
settings.add_collaborator_inactive_user = Cannot add an inactive user as a collaborator.
settings.delete_collaborator = Remove
settings.collaborator_deletion = Remove Collaborator
settings.collaborator_deletion_desc = Removing a collaborator will revoke their access to this repository. Continue?
Expand Down
6 changes: 6 additions & 0 deletions routers/repo/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ func CollaborationPost(ctx *context.Context) {
return
}

if !u.IsActive {
ctx.Flash.Error("cannot add an inactive user as a collaborator")
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
return
}

// Organization is not allowed to be added as a collaborator.
if u.IsOrganization() {
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
Expand Down

0 comments on commit cbf4c92

Please sign in to comment.