Changeset 220


Ignore:
Timestamp:
Sep 16, 2009, 12:47:02 PM (11 years ago)
Author:
lucas
Message:

redmine-add: cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ror-farm/redmine/redmine-add

    r199 r220  
    11#! /bin/sh
    22
    3 # Redmine add issue script for Bearstech RoR hosting.
     3# Redmine CLI interface for Bearstech RoR hosting.
    44# Copyright (C) 2008 Bearstech - http://bearstech.com
    55#
     
    3737then
    3838  usage
    39   exit
     39  exit 1
    4040fi
    4141
     
    5959      if [ $# -ne 4 ]
    6060      then
    61         echo "Err with arguments : $*"
     61        echo "Error with arguments: $*"
    6262        echo "Please fix error first"
    6363        usage
    64         exit
     64        exit 1
    6565      fi
    6666      ;;
     
    7373  if [ $project -eq 1 ]
    7474  then
    75     echo "+------------------------------------------"
    76     echo "| Project List"
    77     echo "+------------------------------------------"
     75    echo "Projects:"
    7876    echo "SELECT id,name FROM projects" | mysql $Database -N -B 
    7977  fi
     
    8179  if [ $user -eq 1 ]
    8280  then
    83     echo "+------------------------------------------"
    84     echo "| User List"
    85     echo "+------------------------------------------"
     81    echo "Users:"
    8682    echo "SELECT id,login FROM users" | mysql $Database -N -B 
    8783  fi
     
    8985  if [ $right -eq 1 ]
    9086  then
    91     echo "+------------------------------------------"
    92     echo "| Right List"
    93     echo "+------------------------------------------"
     87    echo "Roles:"
    9488    echo "SELECT id,name FROM roles" | mysql $Database -N -B 
    95   fi
    96 
    97   if [ $right -eq 1 ] || [ $user -eq 1 ] || [ $project -eq 1 ]
    98   then
    99     echo "+------------------------------------------"
    10089  fi
    10190
    10291else
    10392
    104   echo "+------------------------------------------"
    105   echo "| Add Rights"
    106   echo "+------------------------------------------"
    107 
    108 # user
    109 # project
    110 # right
     93  echo "Adding $user to project $project with role $right"
    11194
    11295  c_user=`echo "SELECT COUNT(*) from users WHERE login = \"$user\"" | mysql $Database -N -B`
     
    118101    if [ $c_user -ne 1 ]
    119102    then
    120       echo "| Error : cannot find User $user"
     103      echo "Error: cannot find User $user"
    121104    fi
    122105    if [ $c_proj -ne 1 ]
    123106    then
    124       echo "| Error : cannot find Project $project"
     107      echo "Error: cannot find Project $project"
    125108    fi
    126109    if [ $c_righ -ne 1 ]
    127110    then
    128       echo "| Error : cannot find Right $right"
     111      echo "Error: cannot find Right $right"
    129112    fi
    130     echo "+------------------------------------------"
    131113    usage 
    132114  else
     
    138120    if [ $verif -ne 0 ] 
    139121    then
    140       echo "| Error : User $user already member"
    141       echo "+------------------------------------------"
     122      echo "Error: User $user already member"
    142123      usage
    143       exit
     124      exit 1
    144125    fi
    145126
     
    148129    echo "INSERT INTO members VALUES ($(( $last_id + 1 )),$id_user,$id_proj,$id_righ,\"$now\",0) ;" | mysql $Database -N -B
    149130
    150     echo "| User $user added to project $project"
    151     echo "| with rights $right"
    152     echo "+------------------------------------------"
     131    echo "...done"
    153132  fi
    154133fi
Note: See TracChangeset for help on using the changeset viewer.