File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,21 @@ public static function getByUUID($uuid)
122122
123123 $ result = $ query ->first ();
124124
125- // @TODO: saving after calling this could end up resetting the daemon secret.
126- // We probably need to just allow access to self::getUserDaemonSecret() to
127- // get this result.
128125 if (!is_null ($ result )) {
129126 $ result ->daemonSecret = self ::getUserDaemonSecret ($ result );
130127 }
131128
129+ // Prevent saving of model called in this manner.
130+ // Prevents accidental overwrite of main daemon secret.
131+ $ result ::saving (function () {
132+ return false ;
133+ });
134+
135+ // Prevent deleting this model call.
136+ $ result ::deleting (function () {
137+ return false ;
138+ });
139+
132140 self ::$ serverUUIDInstance [$ uuid ] = $ result ;
133141 return self ::$ serverUUIDInstance [$ uuid ];
134142
You can’t perform that action at this time.
0 commit comments