summaryrefslogtreecommitdiffstats
path: root/bin/addproject
diff options
context:
space:
mode:
authorroot <root@dev.spline.de>2008-08-17 15:20:12 +0200
committerroot <root@dev.spline.de>2008-08-17 15:20:12 +0200
commit4f886b2cbbc86353c81364710f187cc07aec0305 (patch)
treec81cb46c7c6c3d4feafe5a67c0895ebb023a09fb /bin/addproject
parentf27184e291baddcc572ddd2db7ccbafd42278620 (diff)
downloaddev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.tar.gz
dev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.tar.xz
dev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.zip
add some sanity checks
Diffstat (limited to 'bin/addproject')
-rwxr-xr-xbin/addproject27
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."