Browse Source

admin and superadmin as usergroups.

master
Rogier Neeleman 9 years ago
parent
commit
d9159bed02
  1. 12
      application/migrations/20160304220000_add_user.php
  2. 4
      application/models/Login_model.php

12
application/migrations/20160304220000_add_user.php

@ -29,6 +29,18 @@ class Migration_Add_user extends CI_Migration @@ -29,6 +29,18 @@ class Migration_Add_user extends CI_Migration
'type' => 'VARCHAR',
'constraint' => '80',
),
'admin' => array(
'type' => 'INT',
'constraint' => '1',
'unsigned' => TRUE,
'default' => '0',
),
'superadmin' => array(
'type' => 'INT',
'constraint' => '1',
'unsigned' => TRUE,
'default' => '0',
),
));
$this->dbforge->add_key('id', TRUE);
$this->dbforge->create_table('user');

4
application/models/Login_model.php

@ -20,7 +20,7 @@ class Login_model extends CI_Model @@ -20,7 +20,7 @@ class Login_model extends CI_Model
$regioid = $this->security->xss_clean($this->input->post('regioid'));
// Search for user
$this->db->select('id, regioid');
$this->db->select('id, regioid, admin, superadmin');
$this->db->where('username', $username);
$this->db->where('password', sha1($password));
$this->db->where('regioid', $regioid);
@ -35,6 +35,8 @@ class Login_model extends CI_Model @@ -35,6 +35,8 @@ class Login_model extends CI_Model
$userdata = array(
'id' => $row->id,
'regio' => $row->regioid,
'admin' => $row->admin,
'superadmin' => $row->superadmin,
'validated' => true
);

Loading…
Cancel
Save