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