diff options
author | 6543 <6543@obermui.de> | 2021-03-01 01:47:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 01:47:30 +0100 |
commit | a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8 (patch) | |
tree | 92edf61ff2447e067a676832844a129050b4ec0f /models/org.go | |
parent | e0900310c4354311362ef69d15c302c215eaa2a2 (diff) | |
download | gitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.tar.gz gitea-a4148c0f12fe5a93d2c9a40f24d4813bcfef4ff8.zip |
Repository transfer has to be confirmed, if user can not create repo for new owner (#14792)
* make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination
* if new pending transfer ocured, create UI & Mail notifications
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/org.go b/models/org.go index ee867eec88..437d57d056 100644 --- a/models/org.go +++ b/models/org.go @@ -391,6 +391,20 @@ func CanCreateOrgRepo(orgID, uid int64) (bool, error) { Exist(new(Team)) } +// GetUsersWhoCanCreateOrgRepo returns users which are able to create repo in organization +func GetUsersWhoCanCreateOrgRepo(orgID int64) ([]*User, error) { + return getUsersWhoCanCreateOrgRepo(x, orgID) +} + +func getUsersWhoCanCreateOrgRepo(e Engine, orgID int64) ([]*User, error) { + users := make([]*User, 0, 10) + return users, x. + Join("INNER", "`team_user`", "`team_user`.uid=`user`.id"). + Join("INNER", "`team`", "`team`.id=`team_user`.team_id"). + Where(builder.Eq{"team.can_create_org_repo": true}.Or(builder.Eq{"team.authorize": AccessModeOwner})). + And("team_user.org_id = ?", orgID).Asc("`user`.name").Find(&users) +} + func getOrgsByUserID(sess *xorm.Session, userID int64, showAll bool) ([]*User, error) { orgs := make([]*User, 0, 10) if !showAll { |