1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER="mailto:resource-room-sauna@example.com" 6 SENDER="mailto:paul.boddie@example.com" 7 OUTSIDESENDER="mailto:paul.boddie@example.net" 8 9 mkdir -p "$PREFS/$USER" 10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 11 echo 'share' > "$PREFS/$USER/freebusy_sharing" 12 cat > "$PREFS/$USER/scheduling_function" <<EOF 13 schedule_in_freebusy 14 same_domain_only 15 EOF 16 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times" 17 echo 'PT60S' > "$PREFS/$USER/freebusy_offers" 18 19 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ 20 | "$SHOWMAIL" \ 21 > out0.tmp 22 23 grep -q 'METHOD:REPLY' out0.tmp \ 24 && ! grep -q '^FREEBUSY' out0.tmp \ 25 && echo "Success" \ 26 || echo "Failed" 27 28 # Attempt to schedule an event. 29 30 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR 31 32 "$LIST_SCRIPT" $LIST_ARGS "$OUTSIDESENDER" "freebusy" \ 33 | tee out0f.tmp \ 34 | grep -q "^20141126T150000Z${TAB}20141126T154500Z" \ 35 && echo "Success" \ 36 || echo "Failed" 37 38 # Present the request to the resource. 39 40 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \ 41 | tee out1r.tmp \ 42 | "$SHOWMAIL" \ 43 > out1.tmp 44 45 grep -q 'METHOD:REPLY' out1.tmp \ 46 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \ 47 && echo "Success" \ 48 || echo "Failed" 49 50 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 51 > out1f.tmp 52 53 ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out1f.tmp" \ 54 && echo "Success" \ 55 || echo "Failed" 56 57 # Relax the scheduling function. 58 59 cat > "$PREFS/$USER/scheduling_function" <<EOF 60 schedule_in_freebusy 61 EOF 62 63 # Present the request to the resource. 64 65 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \ 66 | tee out2r.tmp \ 67 | "$SHOWMAIL" \ 68 > out2.tmp 69 70 grep -q 'METHOD:REPLY' out2.tmp \ 71 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \ 72 && echo "Success" \ 73 || echo "Failed" 74 75 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 76 | tee out2f.tmp \ 77 | grep -q "^20141126T150000Z${TAB}20141126T154500Z" \ 78 && echo "Success" \ 79 || echo "Failed" 80 81 # Check the free/busy state of the resource again. 82 83 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \ 84 | "$SHOWMAIL" \ 85 > out3.tmp 86 87 grep -q 'METHOD:REPLY' out3.tmp \ 88 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out3.tmp \ 89 && echo "Success" \ 90 || echo "Failed" 91 92 # Try a different scheduling function. 93 94 ACL="$PWD/acl.tmp" 95 96 cat > "$PREFS/$USER/scheduling_function" <<EOF 97 schedule_in_freebusy 98 access_control_list "$ACL" 99 EOF 100 101 # Try without an ACL. 102 103 cat > "$ACL" <<EOF 104 EOF 105 106 # Attempt to schedule an event. 107 108 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR 109 110 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 111 | tee out3f.tmp \ 112 | grep -q "^20141126T160000Z${TAB}20141126T164500Z" \ 113 && echo "Success" \ 114 || echo "Failed" 115 116 # Present the request to the resource. 117 118 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \ 119 | tee out4r.tmp \ 120 | "$SHOWMAIL" \ 121 > out4.tmp 122 123 grep -q 'METHOD:REPLY' out4.tmp \ 124 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out4.tmp \ 125 && echo "Success" \ 126 || echo "Failed" 127 128 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 129 > out4f.tmp 130 131 ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out4f.tmp" \ 132 && echo "Success" \ 133 || echo "Failed" 134 135 # Try with an unreasonable ACL. 136 137 cat > "$ACL" <<EOF 138 decline 139 EOF 140 141 # Attempt to schedule an event. 142 143 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR 144 145 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 146 | tee out4s.tmp \ 147 | grep -q "^20141126T160000Z${TAB}20141126T164500Z" \ 148 && echo "Success" \ 149 || echo "Failed" 150 151 # Present the request to the resource. 152 153 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \ 154 | tee out5r.tmp \ 155 | "$SHOWMAIL" \ 156 > out5.tmp 157 158 grep -q 'METHOD:REPLY' out5.tmp \ 159 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out5.tmp \ 160 && echo "Success" \ 161 || echo "Failed" 162 163 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 164 > out5f.tmp 165 166 ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out5f.tmp" \ 167 && echo "Success" \ 168 || echo "Failed" 169 170 # Try with a reasonable ACL. 171 172 cat > "$ACL" <<EOF 173 accept 174 decline attendee simon.skunk@example.com 175 EOF 176 177 # Attempt to schedule an event. 178 179 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR 180 181 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 182 | tee out5s.tmp \ 183 | grep -q "^20141126T160000Z${TAB}20141126T164500Z" \ 184 && echo "Success" \ 185 || echo "Failed" 186 187 # Present the request to the resource. 188 189 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \ 190 | tee out6r.tmp \ 191 | "$SHOWMAIL" \ 192 > out6.tmp 193 194 grep -q 'METHOD:REPLY' out6.tmp \ 195 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out6.tmp \ 196 && echo "Success" \ 197 || echo "Failed" 198 199 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 200 > out6f.tmp 201 202 ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "out6f.tmp" \ 203 && echo "Success" \ 204 || echo "Failed" 205 206 # Modify the ACL, using the implicit preference setting to hold the list. 207 208 cat > "$PREFS/$USER/scheduling_function" <<EOF 209 schedule_in_freebusy 210 access_control_list 211 EOF 212 213 cat > "$PREFS/$USER/acl" <<EOF 214 accept 215 decline attendee simon.skunk@example.com 216 accept organiser mailto:paul.boddie@example.com 217 EOF 218 219 # Present the request to the resource. 220 221 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \ 222 | tee out7r.tmp \ 223 | "$SHOWMAIL" \ 224 > out7.tmp 225 226 grep -q 'METHOD:REPLY' out7.tmp \ 227 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out7.tmp \ 228 && echo "Success" \ 229 || echo "Failed" 230 231 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 232 | tee out7f.tmp \ 233 | grep -q "^20141126T160000Z${TAB}20141126T164500Z" \ 234 && echo "Success" \ 235 || echo "Failed" 236 237 rm "$ACL"