@@ -74,6 +74,9 @@ class Options extends Ext
7474 /** @var callable|null */
7575 private $ _customFn ;
7676
77+ /** @var bool Enable data fetch (used for permissions) */
78+ private $ _get = true ;
79+
7780 /** @var string[] List of columns to include in the output */
7881 private $ _includes = [];
7982
@@ -185,6 +188,19 @@ public function fn($_ = null)
185188 return $ this ->_getSet ($ this ->_customFn , $ _ );
186189 }
187190
191+ /**
192+ * Get / set the `get` flag. This allows the options to be disabled (e.g. for a read only view)
193+ * based on user permissions.
194+ *
195+ * @param bool|null $_ `true` to enable, `false` to disable.
196+ *
197+ * @return ($_ is null ? bool : $this)
198+ */
199+ public function get ($ _ = null )
200+ {
201+ return $ this ->_getSet ($ this ->_get , $ _ );
202+ }
203+
188204 /**
189205 * Column names from `value()` and `label()` that should be included in the output object for
190206 * each option, in addition to the value and label.
@@ -363,6 +379,11 @@ public function where($_ = null)
363379 */
364380 public function exec ($ db , $ refresh , $ search = null , $ find = null )
365381 {
382+ // Local enablement
383+ if ($ this ->_get === false ) {
384+ return false ;
385+ }
386+
366387 // If search only, and not a search action, then just return false
367388 if ($ this ->searchOnly () && $ search === null && $ find === null ) {
368389 return false ;
0 commit comments