ridwanskaterock / cicool

Cicool is a multifunctional application that is used to facilitate your work in creating a system, CMS, E-Comerce and others
20 stars 13 forks source link

Possible bug in API Function /user/add/ ? #157

Closed carlosanpardo closed 6 years ago

carlosanpardo commented 6 years ago

Hello, In the API Function /user/add/ you have a mistake in the file "application/controllers/api/User.php" ?

$group = json_decode($this->post('group'));
    if (is_array($group) AND count($group)) {
        $user_id = $save_user;
        foreach ($this->post('group') as $group_id) {
            $this->aauth->add_member($user_id, $group_id);              
    }
}

You receive with the POST the GROUPS and use the function json_decode to convert the string in an array but in the FOREACH you use the POST that is an string variable and not the GROUP that is an array variable.

This is a mistake of the code or can I send directly an array in the API. If yes What is the structure of the string to declare the array?

Currently Im using this estructure: ["2","3"] (Each number is the ID of the group) but is not working.

Thank you for check this issue,

ridwanskaterock commented 6 years ago

on latest version group insert removed on API for it will use member group for default thanks