Differential D12680 Diff 30538 src/applications/policy/controller/PhabricatorPolicyEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/policy/controller/PhabricatorPolicyEditController.php
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | public function processRequest() { | ||||
| $root_id = celerity_generate_unique_node_id(); | $root_id = celerity_generate_unique_node_id(); | ||||
| $default_action = $policy->getDefaultAction(); | $default_action = $policy->getDefaultAction(); | ||||
| $rule_data = $policy->getRules(); | $rule_data = $policy->getRules(); | ||||
| $errors = array(); | $errors = array(); | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $data = $request->getStr('rules'); | $data = $request->getStr('rules'); | ||||
| $data = @json_decode($data, true); | try { | ||||
| if (!is_array($data)) { | $data = phutil_json_decode($data); | ||||
| throw new Exception('Failed to JSON decode rule data!'); | } catch (PhutilJSONParserException $ex) { | ||||
| throw new PhutilProxyException( | |||||
| pht('Failed to JSON decode rule data!'), | |||||
| $ex); | |||||
| } | } | ||||
| $rule_data = array(); | $rule_data = array(); | ||||
| foreach ($data as $rule) { | foreach ($data as $rule) { | ||||
| $action = idx($rule, 'action'); | $action = idx($rule, 'action'); | ||||
| switch ($action) { | switch ($action) { | ||||
| case 'allow': | case 'allow': | ||||
| case 'deny': | case 'deny': | ||||
| ▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines | |||||