| @@ 92-102 (lines=11) @@ | ||
| 89 | { |
|
| 90 | /** @var Group $group */ |
|
| 91 | $group = $this->Groups->get($id, ['contain' => []]); |
|
| 92 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
| 93 | $group = $this->Groups->patchEntity($group, $this->request->getData()); |
|
| 94 | if ($result = $this->Groups->save($group)) { |
|
| 95 | $this->Flash->success(__d('community', 'The group has been updated.')); |
|
| 96 | return $this->App->redirect([ |
|
| 97 | 'apply' => ['action' => 'edit', $result->id] |
|
| 98 | ]); |
|
| 99 | } else { |
|
| 100 | $this->Flash->error(__d('community', 'The group could not be updated. Please, try again.')); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | $parents = $this->Groups->getTreeList(); |
|
| 105 | $this->set(compact('group', 'parents')); |
|
| @@ 88-96 (lines=9) @@ | ||
| 85 | $user = $this->Users->get($id, ['contain' => []]); |
|
| 86 | $user->set('password', null); |
|
| 87 | ||
| 88 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
| 89 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
|
| 90 | if ($result = $this->Users->save($user)) { |
|
| 91 | $this->Flash->success(__d('community', 'Password has been updated.')); |
|
| 92 | return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
| 93 | } else { |
|
| 94 | $this->Flash->error(__d('community', 'Password could not be updated. Please, try again.')); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | $this |
|
| 99 | ->set(compact('user')) |
|
| @@ 120-133 (lines=14) @@ | ||
| 117 | $user = $this->Users->get($id); |
|
| 118 | $groups = $this->Users->Groups->getTreeList(); |
|
| 119 | ||
| 120 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
| 121 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
|
| 122 | if ($result = $this->Users->save($user)) { |
|
| 123 | $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( |
|
| 124 | '<strong>«%s»</strong>', |
|
| 125 | $result->get('login') |
|
| 126 | ))); |
|
| 127 | return $this->App->redirect([ |
|
| 128 | 'apply' => ['action' => 'edit', $result->id] |
|
| 129 | ]); |
|
| 130 | } else { |
|
| 131 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
|
| 132 | } |
|
| 133 | } |
|
| 134 | ||
| 135 | $this |
|
| 136 | ->set(compact('user', 'groups')) |
|