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