view scripts/server-ctl @ 5222:9bf221cebef3

Make properties method return only properties the user can search. See: https://sourceforge.net/p/roundup/mailman/roundup-devel/thread/20170405002844.2004B80690%40vm71.cs.umb.edu/#msg35769250 [Roundup-devel] Bug in context/properties, lists properties user can't search. The HTMLClass::properties() method returns a list of all properties. This is used when creating sort on/group by filters on index pages. However somewhere in the code, a user needs search permission on the property in order for it to be used for grouping or sorting. This means the user can choose to sort/group an index page by a property that they have no search permission for. As a result the sort/group is ignored. This is confusing. I have changed the properties method to only return properties the user has View/Search permissions on. I also added a new cansearch argument set by default to True. If set to False, all properties regardless of Search permission are returned. Doc updated to include the new default operation and mention the use of cansearch argument.
author John Rouillard <rouilj@ieee.org>
date Wed, 05 Apr 2017 21:38:32 -0400
parents 311ad623e2d1
children
line wrap: on
line source

#!/bin/sh

#
# Configuration
#
CONFFILE="/var/roundup/server-config.ini"

# this will end up with extra space, but it should be ignored in the script
PIDFILE=`grep '^pidfile' ${CONFFILE} | awk -F = '{print $2}' `
SERVER="/usr/local/bin/roundup-server -C ${CONFFILE}"
ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
    ARGS="help"
fi

if [ -z "${PIDFILE}" ] ; then
    echo "pidfile option must be set in configuration file"
    exit 1
fi

for ARG in $@ $ARGS
do
    # check for pidfile
    if [ -f $PIDFILE ] ; then
	PID=`cat $PIDFILE`
	if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
	    STATUS="roundup-server (pid $PID) running"
	    RUNNING=1
	else
	    STATUS="roundup-server (pid $PID?) not running"
	    RUNNING=0
	fi
    else
	STATUS="roundup-server (no pid file) not running"
	RUNNING=0
    fi

    case $ARG in
    start)
	if [ $RUNNING -eq 1 ] ; then
	    echo "$0 $ARG: roundup-server (pid $PID) already running"
	    continue
	fi
	if $SERVER ; then
	    echo "$0 $ARG: roundup-server started"
	else
	    echo "$0 $ARG: roundup-server could not be started"
	    ERROR=1
	fi
	;;
    condstart)
	if [ $RUNNING -eq 1 ] ; then
	    continue
	fi
	if $SERVER ; then
	    echo "$0 $ARG: roundup-server started"
	else
	    echo "$0 $ARG: roundup-server could not be started"
	    ERROR=1
	fi
	;;
    stop)
	if [ $RUNNING -eq 0 ] ; then
	    echo "$0 $ARG: $STATUS"
	    continue
	fi
	if kill $PID ; then
	    echo "$0 $ARG: roundup-server stopped"
	else
	    echo "$0 $ARG: roundup-server could not be stopped"
	    ERROR=2
	fi
	;;
    status)
	echo $STATUS
	;;
    *)
	echo "usage: $0 (start|condstart|stop|status)"
	cat <<EOF

    start      - start roundup-server
    condstart  - start roundup-server if it's not running
    stop       - stop roundup-server
    status     - display roundup-server status

EOF
	ERROR=3
    ;;

    esac

done

exit $ERROR


Roundup Issue Tracker: http://roundup-tracker.org/