KanonConductor

changeset 69:57f257f45d1d

fixed able to browse SVN repository without permission
author okazaki
date Sat, 26 Nov 2011 01:17:26 +0900
parents 803f7b41dfdf
children 3770758d54e5
files opt/kanon/bin/kanon-create-project
diffstat 1 files changed, 48 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/opt/kanon/bin/kanon-create-project	Wed Nov 02 06:36:47 2011 +0900
     1.2 +++ b/opt/kanon/bin/kanon-create-project	Sat Nov 26 01:17:26 2011 +0900
     1.3 @@ -239,9 +239,54 @@
     1.4  file = "$KANON_CONFIG"/trac-template/"$TEMPLATE"/trac.ini
     1.5  "  >> $KANON_VAR/trac/$PROJECT_NAME/conf/trac.ini
     1.6  
     1.7 -# authz_fileとauthz_module_nameの空設定を削除
     1.8 -grep -v 'authz_* = ' $KANON_VAR/trac/$PROJECT_NAME/conf/trac.ini | grep -v permission_policies > /tmp/$PROJECT_NAME_trac.ini
     1.9 -mv /tmp/$PROJECT_NAME_trac.ini $KANON_VAR/trac/$PROJECT_NAME/conf/trac.ini
    1.10 +# svnとそれ以外のリポジトリの違いを設定します
    1.11 +TRAC_PROJECT_INI=$KANON_VAR/trac/$PROJECT_NAME/conf/trac.ini
    1.12 +TRAC_TMP_INI=/tmp/$PROJECT_NAME_trac.ini
    1.13 +if [ "$REPO_TYPE" = "svn" ]
    1.14 +then
    1.15 +    PERMISSION_POLICIES0=''
    1.16 +    TEMPLAE_TRAC_INI_FILE_NAME=$TRAC_PROJECT_INI
    1.17 +    while [ -e "$TEMPLAE_TRAC_INI_FILE_NAME" ] # ファイルの存在確認
    1.18 +    do
    1.19 +        # permission_policiesからAuthzSourcePolicyを削除、残りの設定値を取得、
    1.20 +         # 行末の',' ,' ', CRを削除、先頭にAuthzSourcePolicyを追加し変数に設定します。
    1.21 +        PERMISSION_POLICIES=`\
    1.22 +          grep "^permission_policies = " $TEMPLAE_TRAC_INI_FILE_NAME | \
    1.23 +          sed -e 's/\(AuthzSourcePolicy,* *\)//g' \
    1.24 +              -e 's/^permission_policies = \(.*\)$/AuthzSourcePolicy, \1/' \
    1.25 +              -e 's/,* *\r*$//'`
    1.26 +        if [ -n "$PERMISSION_POLICIES" ] ; then
    1.27 +            if [ -n "$PERMISSION_POLICIES0" ] ; then
    1.28 +                break
    1.29 +            else
    1.30 +                PERMISSION_POLICIES0=$PERMISSION_POLICIES
    1.31 +                PERMISSION_POLICIES=''
    1.32 +            fi
    1.33 +        fi
    1.34 +        # inheritしているファイル名を抜き出します
    1.35 +        TEMPLAE_TRAC_INI_FILE_NAME=`cat $TEMPLAE_TRAC_INI_FILE_NAME | \
    1.36 +          sed -n -e "/\[inherit\]/,/\[/p" | grep "^file = .*$" | \
    1.37 +          sed -e 's/^file = \(.*\)\r*$/\1/'`
    1.38 +    done
    1.39 +    if [ -z "$PERMISSION_POLICIES" ] ; then
    1.40 +        if [ -n "$PERMISSION_POLICIES0" ] ; then
    1.41 +            PERMISSION_POLICIES="$PERMISSION_POLICIES0"
    1.42 +        else
    1.43 +            PERMISSION_POLICIES='AuthzSourcePolicy'
    1.44 +        fi
    1.45 +    fi
    1.46 +    # authz_fileを削除、authz_module_nameにプロジェクト名を設定、
    1.47 +    # permission_policiesを削除し、継承しているファイル等から作成した値を設定
    1.48 +    grep -v 'authz_file = ' $TRAC_PROJECT_INI | \
    1.49 +      grep -v 'permission_policies = ' | \
    1.50 +      sed -e "s/^\(authz_module_name = \)/\1$PROJECT_NAME/" \
    1.51 +          -e "/^\[trac\]$/apermission_policies = $PERMISSION_POLICIES" > \
    1.52 +      $TRAC_TMP_INI
    1.53 +else
    1.54 +    # SVN以外は, authz_file, authz_module_nameを削除
    1.55 +    grep -v 'authz_.* = ' $TRAC_PROJECT_INI > $TRAC_TMP_INI
    1.56 +fi
    1.57 +mv $TRAC_TMP_INI $TRAC_PROJECT_INI
    1.58  
    1.59  # HudsonTracPlugPluginを有効化
    1.60  if [ "$JENKINS" = 'y' ]