*/
public function index()
{
- $users = $this->Users->find("all")
- ->where(["UserTypes.name = " => "Administration" ])
- ;
- $this->set('users', $this->paginate($users));
- $this->set('_serialize', ['users','paging']);
+ try {
+ $users = $this->Users->find("all")->contain(["UserTypes"])
+ ->where(["UserTypes.name = " => "Administration" ])
+ ;
+ $this->set([
+ 'message' => "Success",
+ 'users' => $this->paginate($users),
+ '_serialize' => ['message', 'users']
+ ]);
+ }catch(Exception $e){
+
+ }
}
/**
}
}
-
- public function administrationUsers () {
- try {
- $users = $this->Users->find("all")->contain(["UserTypes"])
- ->where(["UserTypes.name = " => "Administration" ])
- ;
- $this->set([
- 'message' => "Success",
- 'users' => $this->paginate($users),
- '_serialize' => ['message', 'users']
- ]);
- }catch(Exception $e){
-
- }
- }
-
public function servicesproviderUsers(){
try {
$users = $this->Users->find("all")->contain(["UserTypes"])
return $this->redirect(['action' => 'index']);
}
+
+
+ public function register()
+ {
+ if ($this->request->is('post')) {
+ $user = $this->Auth->user();
+ if ($user) {
+ $this->set('digest', $_SERVER["PHP_AUTH_DIGEST"]);
+ }else{
+ $this->Flash->error(__('Invalid username or password, please try again'));
+ }
+ }
+
+ }
+
public function logout()
{
return $this->redirect($this->Auth->logout());
public function isAuthorized($user)
{
//If user is auth
- if ($this->Auth->user()){
- if ($this->request->is('edit')){
+ if ($this->request->param('action') === 'register'){
+ $user = $this->Auth->user();
+
+ if ($user){
+
return true;
}
}
+
+
return parent::isAuthorized($user);
}
*/
public function beforeFilter(\Cake\Event\Event $event)
{
- $this->Auth->deny('delete','edit');
+ $this->Auth->allow('servicesproviderUsers');
+ $this->Auth->deny('delete');
parent::beforeFilter($event);
}