]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/avoid_attachement_ui_if_upload_not_allowed.mdwn
recap of yamlfront issue opened on github
[ikiwiki.git] / doc / todo / avoid_attachement_ui_if_upload_not_allowed.mdwn
1 Any way to make it so an edit page doesn't offer the attachment capability
2 unless it matches a specific user, is an admin, and/or is an allowed page?
3 (For now, I have it on all pages, and then it prohibits after I submit
4 based on the allowed_attachments.)
5
6 > To do that, ikiwiki would have to try to match the `allowed_attachments`
7 > pagespec against a sort of dummy upload to the current page. Then if it
8 > failed, assume all real uploads would fail. Now consider a pagespec like
9 > "user(joey) and mimetype(audio/mpeg)" -- it'd be hard to make a dummy
10 > upload to test this pagespec against.
11
12 > So, there would need to be some sort of test mode, where terms like
13 > `mimetype()` always succeed. But then consider a pagespec like
14 > "user(joey) and !mimetype(video/mpeg)" -- if mimetype succeeds, this
15 > fails.
16
17 > So, maybe we can instead just filter out all the pagespec terms aside
18 > from `user()`, `ip()`, and `admin()`. Transforming that into just
19 > "user(joey)", which would succeed in the test.
20
21 > That'd work, I guess. Pulling a pagespec apart, filtering out terms, and
22 > putting it back together is nontrivial, but doable.
23
24 > Other approach would be to have a separate pagespec that explicitly
25 > controlls what pages to show the attachment UI on. --[[Joey]]