comparison feeds.tcl @ 666:79b5d8944eea

feeds: Improve admin checks.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 20 Feb 2021 17:52:49 +0200
parents 8bde8f798188
children 2737e90aad83
comparison
equal deleted inserted replaced
665:4156adacdc31 666:79b5d8944eea
168 168
169 # Check and handle arguments 169 # Check and handle arguments
170 set rarglist [::textutil::split::splitx $uargs {\s+}] 170 set rarglist [::textutil::split::splitx $uargs {\s+}]
171 set rcmd [lindex $rarglist 0] 171 set rcmd [lindex $rarglist 0]
172 set rargs [lrange $rarglist 1 end] 172 set rargs [lrange $rarglist 1 end]
173 set qadmin [matchattr $uhand n]
174 # set qadmin 0
173 175
174 if {[feeds_cmd_match "help" $rcmd]} { 176 if {[feeds_cmd_match "help" $rcmd]} {
175 # Show help 177 # Show help
176 foreach ukey $feeds_messages(help_full) { 178 foreach ukey $feeds_messages(help_full) {
177 feeds_msg $upublic $unick $uchan $ukey 179 feeds_msg $upublic $unick $uchan $ukey
195 if {$ufound == 0} { 197 if {$ufound == 0} {
196 feeds_msg $upublic $unick $uchan "search_no_matches" [list $utext] 198 feeds_msg $upublic $unick $uchan "search_no_matches" [list $utext]
197 } 199 }
198 } elseif {[feeds_cmd_match "force" $rcmd]} { 200 } elseif {[feeds_cmd_match "force" $rcmd]} {
199 # Force check for new entries 201 # Force check for new entries
200 if {![matchattr $uhand n]} { 202 if {!$qadmin} {
201 feeds_msg $upublic $unick $uchan "no_access" 203 feeds_msg $upublic $unick $uchan "no_access"
204 return 0
202 } 205 }
203 206
204 feeds_check_do 1 $upublic $unick $uchan 207 feeds_check_do 1 $upublic $unick $uchan
205 } elseif {[feeds_cmd_match "list" $rcmd]} { 208 } elseif {[feeds_cmd_match "list" $rcmd]} {
206 # List feeds 209 # List feeds
208 211
209 if {[feeds_cmd_match "all" $uarg]} { 212 if {[feeds_cmd_match "all" $uarg]} {
210 # Long list 213 # Long list
211 set utext [string tolower [join [lrange $rargs 1 end] " "]] 214 set utext [string tolower [join [lrange $rargs 1 end] " "]]
212 215
213 if {$upublic && ![matchattr $uhand n]} { 216 if {$upublic && !$qadmin} {
214 feeds_msg $upublic $unick $uchan "feed_list_long_denied" [list $rcmd $utext] 217 feeds_msg $upublic $unick $uchan "feed_list_long_denied" [list $rcmd $utext]
215 return 0 218 return 0
216 } 219 }
217 220
218 set ulistitem [feeds_qm "feed_list_item_long"] 221 set ulistitem [feeds_qm "feed_list_item_long"]
269 feeds_msg $upublic $unick $uchan "help_history" 272 feeds_msg $upublic $unick $uchan "help_history"
270 return 0 273 return 0
271 } 274 }
272 275
273 set utext [string tolower [join $rargs " "]] 276 set utext [string tolower [join $rargs " "]]
274 if {$upublic && ![matchattr $uhand n]} { 277 if {$upublic && !$qadmin} {
275 feeds_msg $upublic $unick $uchan "feed_list_long_denied" [list $rcmd $utext] 278 feeds_msg $upublic $unick $uchan "feed_list_long_denied" [list $rcmd $utext]
276 return 0 279 return 0
277 } 280 }
278 281
279 # Validate feed name 282 # Validate feed name