Skip to content

Commit

Permalink
unset_user_var() added
Browse files Browse the repository at this point in the history
perm_id to perm_par
some minor changes
  • Loading branch information
Emre Akay committed Jun 30, 2014
1 parent 386a77e commit 7c050bc
Showing 1 changed file with 52 additions and 13 deletions.
65 changes: 52 additions & 13 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public function __construct() {
/**
* Hash password
* Hash the password for storage in the database
* (thanks to Jacob Tomlinson for contribution)
* @param string $pass Password to hash
* @param $userid
* @return string Hashed password
*/
function hash_password($pass, $userid) {
Expand Down Expand Up @@ -1058,12 +1060,14 @@ public function create_perm($perm_name, $definition='') {
/**
* Update permission
* Updates permission name and description
* @param int $perm_id Permission id
* @param int|string $perm_par Permission id or permission name
* @param string $perm_name New permission name
* @param string $definition Permission description
* @return bool Update success/failure
*/
public function update_perm($perm_id, $perm_name, $definition=false) {
public function update_perm($perm_par, $perm_name, $definition=false) {

$perm_id = $this->get_perm_id($perm_par);

$data['name'] = $perm_name;

Expand All @@ -1077,10 +1081,12 @@ public function update_perm($perm_id, $perm_name, $definition=false) {
/**
* Delete permission
* Delete a permission from database. WARNING Can't be undone
* @param int $perm_id Permission id to delete
* @param int|string $perm_par Permission id or perm name to delete
* @return bool Delete success/failure
*/
public function delete_perm($perm_id) {
public function delete_perm($perm_par) {

$perm_id = $this->get_perm_id($perm_par);

// deletes from perm_to_gropup table
$this->CI->db->where('pern_id', $perm_id);
Expand Down Expand Up @@ -1569,8 +1575,26 @@ public function set_user_var( $key, $value, $user_id = false ) {
$user_id = $this->CI->session->userdata('id');
}


}


/**
* Unset User Variable as key value
* @param string $key
* @param int $user_id ; if not given current user
* @return bool
*/
public function unset_user_var( $key, $user_id = false ) {

if ( ! $user_id ){
$user_id = $this->CI->session->userdata('id');
}


}


/**
* Get User Variable by key
* Return string of variable value or false
Expand All @@ -1584,6 +1608,16 @@ public function get_user_var( $key, $user_id = false){
$user_id = $this->CI->session->userdata('id');
}

$query = $this->CI->db->where('user_id', $user_id);
$query = $this->CI->db->where('key', $key);

$query = $this->CI->db->get( $this->config_vars['user_variables'] );

// if variable not set
if ($query->num_rows() < 1) {
return false;
}

}

########################
Expand Down Expand Up @@ -1617,25 +1651,30 @@ public function get_aauth_var( $key ){

// $this->CI->session->userdata('id')

/* coming with v3
----------------
* captcha (hmm bi bakalım)
* parametre olarak array alma
* stacoverflow
* public id sini 0 a eşitleyip öyle kontrol yapabilirdik (oni boşver uşağum)
*
*/

/**
* Coming with v2
* -------------
* public id sini 0 a eşitleyip öyle kontrol yapabilirdik (oni boşver uşağum)
* permission id yi permission parametre yap
* performance impr. // tablo isimlerini configden çekmesin (şimdilik çeksin)
* captcha (hmm bi bakalım)
*
* tmam // permission id yi permission parametre yap
* mail fonksiyonları imtihanı
* stacoverflow
* tamam // login e ip aderesi de eklemek lazım
* list_users da grup_par verilirse ve adamın birden fazla grubu varsa nolurkun? // bi denemek lazım belki distinct ile düzelir
* tamam // eğer grup silinmişse kullanıcıları da o gruptan sil (fire)
* tamam // ismember la is admine 2. parametre olarak user id ekle
* tamam // kepp infos errors die bişey yap ajax requestlerinde silinir errorlar
* user variables
* tmam // user variables
* sistem variables
* tamam // user perms
* parametre olarak array alma
* biraz tamam // 4mysql index fulltext index??
* user perms
* tamam gibi // 4mysql index fulltext index??
* geçici ban ve e-mail ile tkrar aktifleştime olayı
*
*
Expand Down

0 comments on commit 7c050bc

Please sign in to comment.