about summary refs log tree commit diff stats
path: root/src/teliva.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-04-05 20:50:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-04-05 20:50:51 -0700
commit5b64c4b3bc41215ff02ba3db1540ab152f737639 (patch)
tree4bf40c293a7cf83cb6b45f72d2d348369c7a4fe5 /src/teliva.c
parentb5aca9a57132d8703a6f0809de91da66fa1bf3cc (diff)
downloadteliva-5b64c4b3bc41215ff02ba3db1540ab152f737639.tar.gz
show common suggestions when editing permissions
Computer owners shouldn't get in the habit of trusting app authors
regarding permissions. But they have to trust somebody, and they already
trust the Teliva platform if they are running it.
Diffstat (limited to 'src/teliva.c')
-rw-r--r--src/teliva.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/teliva.c b/src/teliva.c
index 4ad530e..35c9964 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -1563,6 +1563,17 @@ static void edit_file_operations_predicate_body() {
   }
 }
 
+void print_file_permission_suggestions(int row) {
+  mvaddstr(row++, 0, "-- Some ideas:");
+  mvaddstr(row++, 0, "--  * restrict access to a single file: return filename == 'foo'");
+  mvaddstr(row++, 0, "--  * restrict to reading only: return is_write == false");
+  mvaddstr(row++, 0, "--  * restrict to files with a fixed prefix: return string.find(filename, 'foo') == 1");
+  mvaddstr(row++, 0, "--  * restrict to files with a fixed extension: return filename:sub(-4) == '.txt'");
+  mvaddstr(row++, 0, "--  * restrict to files under some directory: return string.find(filename, 'foo/') == 1");
+  mvaddstr(row++, 0, "--");
+  mvaddstr(row++, 0, "-- Each of these has benefits and drawbacks.");
+}
+
 static void permissions_view() {
   while (true) {
     render_permissions_screen();