Check for email only but not for group or login when adding repositories.
Check for Chili project.identifier for Git repos.
This commit is contained in:
parent
9d54ace1f8
commit
62a26bc087
|
@ -37,7 +37,8 @@ CHILI_ID_GITORIOUS_REPO=`mysql -h$MYSQL_HOSTNAME -u $MYSQL_USER -e \
|
||||||
AND $CHILI_MYSQL_DBNAME.member_roles.role_id=$CHILI_MYSQL_DBNAME.roles.id
|
AND $CHILI_MYSQL_DBNAME.member_roles.role_id=$CHILI_MYSQL_DBNAME.roles.id
|
||||||
AND $CHILI_MYSQL_DBNAME.members.user_id=$CHILI_MYSQL_DBNAME.users.id
|
AND $CHILI_MYSQL_DBNAME.members.user_id=$CHILI_MYSQL_DBNAME.users.id
|
||||||
AND $CHILI_MYSQL_DBNAME.members.project_id=$CHILI_MYSQL_DBNAME.projects.id
|
AND $CHILI_MYSQL_DBNAME.members.project_id=$CHILI_MYSQL_DBNAME.projects.id
|
||||||
AND $CHILI_MYSQL_DBNAME.projects.name=$GITORIOUS_MYSQL_DBNAME.repositories.name
|
AND ($CHILI_MYSQL_DBNAME.projects.name=$GITORIOUS_MYSQL_DBNAME.repositories.name
|
||||||
|
OR $CHILI_MYSQL_DBNAME.projects.identifier=$GITORIOUS_MYSQL_DBNAME.repositories.name)
|
||||||
AND $CHILI_MYSQL_DBNAME.users.type='User'
|
AND $CHILI_MYSQL_DBNAME.users.type='User'
|
||||||
AND $CHILI_MYSQL_DBNAME.users.mail=$GITORIOUS_MYSQL_DBNAME.users.email
|
AND $CHILI_MYSQL_DBNAME.users.mail=$GITORIOUS_MYSQL_DBNAME.users.email
|
||||||
AND $CHILI_MYSQL_DBNAME.roles.name IN ('Инициатор','Менеджер','Major','Manager')
|
AND $CHILI_MYSQL_DBNAME.roles.name IN ('Инициатор','Менеджер','Major','Manager')
|
||||||
|
|
|
@ -31,32 +31,26 @@ repos_to_remove=${repos_to_remove#,}
|
||||||
# === GET DATA FROM RHODECODE SQLITE BASE ===
|
# === GET DATA FROM RHODECODE SQLITE BASE ===
|
||||||
rh_repos_path=`sqlite3 $RHODECODE_SQLITE_PATH "select ui_value FROM rhodecode_ui where ui_section='paths'"`
|
rh_repos_path=`sqlite3 $RHODECODE_SQLITE_PATH "select ui_value FROM rhodecode_ui where ui_section='paths'"`
|
||||||
|
|
||||||
SQLITE_RESULTS=`sqlite3 $RHODECODE_SQLITE_PATH "SELECT repo_name,repo_type,users.username,users.email,users_groups.users_group_name
|
SQLITE_RESULTS=`sqlite3 $RHODECODE_SQLITE_PATH "SELECT repo_name,repo_type,users.email
|
||||||
FROM repositories,users,users_groups,users_groups_members
|
FROM repositories,users
|
||||||
WHERE repositories.user_id=users.user_id
|
WHERE repositories.user_id=users.user_id;"`
|
||||||
AND users.user_id=users_groups_members.user_id
|
|
||||||
AND users_groups.users_group_id=users_groups_members.users_group_id;"`
|
|
||||||
|
|
||||||
# initializing repos arrays and count them
|
# initializing repos arrays and count them
|
||||||
repos_names=
|
repos_names=
|
||||||
repos_paths=
|
repos_paths=
|
||||||
repos_types=
|
repos_types=
|
||||||
repos_users=
|
|
||||||
repos_mails=
|
repos_mails=
|
||||||
repos_groups=
|
|
||||||
|
|
||||||
let nrepos=0
|
let nrepos=0
|
||||||
for r in $SQLITE_RESULTS; do
|
for r in $SQLITE_RESULTS; do
|
||||||
repos_paths[$nrepos]=$rh_repos_path/${r%|*|*|*|*}
|
repos_paths[$nrepos]=$rh_repos_path/${r%|*|*}
|
||||||
tmp=${repos_paths[$nrepos]%/}; repos_names[$nrepos]=${tmp##*/}
|
tmp=${repos_paths[$nrepos]%/}; repos_names[$nrepos]=${tmp##*/}
|
||||||
tmp=${r%|*|*|*}; repos_types[$nrepos]=${tmp#*|}
|
tmp=${r%|*}; repos_types[$nrepos]=${tmp#*|}
|
||||||
case ${repos_types[$nrepos]} in
|
case ${repos_types[$nrepos]} in
|
||||||
hg) repos_types[$nrepos]='Mercurial';;
|
hg) repos_types[$nrepos]='Mercurial';;
|
||||||
git) repos_types[$nrepos]='Git';;
|
git) repos_types[$nrepos]='Git';;
|
||||||
esac
|
esac
|
||||||
tmp=${r%|*|*}; repos_users[$nrepos]=${tmp#*|*|}
|
repos_mails[$nrepos]=${tmp#*|*|}
|
||||||
tmp=${r%|*}; repos_mails[$nrepos]=${tmp#*|*|*|}
|
|
||||||
repos_groups[$nrepos]=${r#*|*|*|*|}
|
|
||||||
let nrepos++
|
let nrepos++
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -71,17 +65,10 @@ for i in `seq 0 $((nrepos-1))`; do
|
||||||
[ "$ALREADY_EXIST" != "" ] && continue
|
[ "$ALREADY_EXIST" != "" ] && continue
|
||||||
|
|
||||||
USERID=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT id
|
USERID=`mysql -h$CHILI_MYSQL_HOSTNAME -u $CHILI_MYSQL_USER -e "SELECT id
|
||||||
FROM $CHILI_MYSQL_DBNAME.users,$CHILI_MYSQL_DBNAME.groups_users
|
FROM $CHILI_MYSQL_DBNAME.users
|
||||||
WHERE users.id=groups_users.user_id
|
WHERE users.status='1'
|
||||||
AND users.status='1'
|
AND users.mail='${repos_mails[$i]}'
|
||||||
AND users.login='${repos_users[$i]}'
|
AND users.type='User'" \
|
||||||
AND users.mail='${repos_mails[$i]}'
|
|
||||||
AND users.type='User'
|
|
||||||
AND groups_users.group_id=(SELECT id
|
|
||||||
FROM $CHILI_MYSQL_DBNAME.users
|
|
||||||
WHERE users.type='Group'
|
|
||||||
AND users.lastname='${repos_groups[$i]}'
|
|
||||||
AND users.status='1')" \
|
|
||||||
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
| grep -v tables_col|xargs|sed "s/ /\n/g"|tail -n+2`
|
||||||
[ "$USERID" == "" ] && continue
|
[ "$USERID" == "" ] && continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue