File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
app/Transformers/Api/Application Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,20 @@ public static function fromRequest(Request $request)
6767 */
6868 protected function authorize (string $ resource ): bool
6969 {
70+ $ allowed = [ApiKey::TYPE_ACCOUNT , ApiKey::TYPE_APPLICATION ];
71+
7072 $ token = $ this ->request ->user ()->currentAccessToken ();
71- if (!$ token instanceof ApiKey || $ token ->key_type !== ApiKey:: TYPE_APPLICATION ) {
73+ if (!$ token instanceof ApiKey || ! in_array ( $ token ->key_type , $ allowed ) ) {
7274 return false ;
7375 }
7476
77+ // If this is not a deprecated application token type we can only check that
78+ // the user is a root admin at the moment. In a future release we'll be rolling
79+ // out more specific permissions for keys.
80+ if ($ token ->key_type === ApiKey::TYPE_ACCOUNT ) {
81+ return $ this ->request ->user ()->root_admin ;
82+ }
83+
7584 return AdminAcl::check ($ token , $ resource , AdminAcl::READ );
7685 }
7786
You can’t perform that action at this time.
0 commit comments