@@ -39,7 +39,7 @@ class GraphQLAction extends Action
3939 /**
4040 * @var array child graphql actions
4141 */
42- private $ actions = [];
42+ private $ authActions = [];
4343 /**
4444 * @var callable a PHP callable that will be called when running an action to determine
4545 * if the current user has the permission to execute the action. If not set, the access
@@ -95,10 +95,21 @@ public function getGraphQLActions()
9595 if ($ this ->schemaArray === true ) {
9696 return [self ::INTROSPECTIONQUERY => 'true ' ];
9797 }
98- if (!$ this ->actions ) {
99- $ this ->actions = array_merge ($ this ->schemaArray [0 ], $ this ->schemaArray [1 ]);
98+ $ ret = array_merge ($ this ->schemaArray [0 ], $ this ->schemaArray [1 ]);
99+ if (!$ this ->authActions ) {
100+ //init
101+ $ this ->authActions = array_merge ($ this ->schemaArray [0 ], $ this ->schemaArray [1 ]);
100102 }
101- return $ this ->actions ;
103+ return $ ret ;
104+ }
105+
106+ /**
107+ * remove action that no need check access
108+ * @param $key
109+ */
110+ public function removeGraphQlAction ($ key )
111+ {
112+ unset($ this ->authActions [$ key ]);
102113 }
103114
104115 /**
@@ -111,8 +122,8 @@ public function run()
111122 //调度状态下将执行构建查询
112123 $ this ->controller ->module ->enableValidation ();
113124 }
114- if ($ this ->actions && $ this ->checkAccess ) {
115- foreach ($ this ->actions as $ childAction ) {
125+ if ($ this ->authActions && $ this ->checkAccess ) {
126+ foreach ($ this ->authActions as $ childAction ) {
116127 call_user_func ($ this ->checkAccess , $ childAction );
117128 }
118129 }
0 commit comments