diff options
Diffstat (limited to 'bin/addproject')
-rwxr-xr-x | bin/addproject | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/bin/addproject b/bin/addproject index 4a038dd..660a245 100755 --- a/bin/addproject +++ b/bin/addproject @@ -1,25 +1,38 @@ #!/bin/bash +dbquery() { + mysql -s -s -e "$@" trac +} + # main function main() { echo - + # project_name may not be an empty string and must be >= 3 characters while [[ ${#project_name} -lt 3 ]] do eask_str "a project name (min 3 chars)" project_name=${REPLY} done - + + if [[ -n $(dbquery "SELECT id FROM project WHERE project_name = '${project_name}'") ]] + then + eerror "Project ${project_name} already exists." + fi + # who requests the project ? - while [[ -z ${user_email} ]] + while [[ -z ${user_name} ]] do - eask_str "email address (*.fu-berlin.de) of applicant" - user_email=${REPLY} - don (*.fu-berlin.de) of applicant" - user_email=${REPLY} + eask_str "username of applicant" + user_name=${REPLY} done + user_email=$(dbquery "SELECT email FROM user WHERE login = '${user_name}'") + if [[ -z ${user_email} ]] + then + eerror "Username ${user_name} does not exist." + fi + einfo einfo "$(color yellow)public project:$(color) read access for everyone with a spline-dev account." \ "write access only for project members. this is the default." |