class mw_data_sql_users extends mw_data{
- var $users;
- var $user;
- var $roles;
- var $actions_roles;
+ public $users;
+ public $user;
+ public $roles;
+ public $actions_roles;
# ----------------------------------------------------------------------------------------
# users
#
- function users($start = 0, $alpha = null, $id_role = null){
+ public function users($start = 0, $alpha = null, $id_role = null){
$sgbd = $this->sgbd();
$env = $this->env();
$users = array("list" => array(), "total" => 0);
return $users;
}
- function list_user_roles($id_user){
+ public function list_user_roles($id_user){
$sgbd = $this->sgbd();
$roles = array();
try{
return $roles;
}
- function user_by_id($id){
+ public function user_by_id($id){
$env = $this->env();
$user = $env->get_model("users");
if($user->load("id", $id) === false) return false;
return $user->get_values();
}
- function user($login){
+ public function user($login){
$env = $this->env();
$user = $env->get_model("users");
if($user->load("login", $login) === false) return false;
return $user->get_values();
}
- function user_exists($login){
+ public function user_exists($login){
$sgbd = $this->sgbd();
$EXISTS = 0;
try{
return $EXISTS;
}
- function add_user($login, $password, $email, $roles){
+ public function add_user($login, $password, $email, $roles){
$sgbd = $this->sgbd();
$user_id = false;
try{
return $user_id;
}
- function set_user($id, $login, $password, $email, $roles){
+ public function set_user($id, $login, $password, $email, $roles){
$sgbd = $this->sgbd();
try{
$sql =
return true;
}
- function clear_user_roles($id_user){
+ public function clear_user_roles($id_user){
$sgbd = $this->sgbd();
try{
$sql = "DELETE FROM #--users_roles WHERE id_user=".$this->eq($id_user);
return true;
}
- function add_user_role($id_user, $id_role){
+ public function add_user_role($id_user, $id_role){
$sgbd = $this->sgbd();
try{
$sql =
return true;
}
- function del_user($login){
+ public function del_user($login){
if(($user = $this->user($login)) !== false){
$sgbd = $this->sgbd();
try{
# roles
#
- function init_roles(){
+ public function init_roles(){
$sgbd = $this->sgbd();
$this->roles = array();
try{
return $this->roles;
}
- function roles(){
+ public function roles(){
if(!isset($this->roles)) return false;
return $this->roles;
}
- function add_role($nom, $intitule){
+ public function add_role($nom, $intitule){
$sgbd = $this->sgbd();
try{
$sql =
return $id_role;
}
- function get_role($id){
+ public function get_role($id){
if($id === "0") return array(
"id" => 0,
"nom" => "",
return $role;
}
- function set_role($id, $nom, $intitule){
+ public function set_role($id, $nom, $intitule){
$sgbd = $this->sgbd();
try{
$sql =
return true;
}
- function clear_role_actions($id_role){
+ public function clear_role_actions($id_role){
$sgbd = $this->sgbd();
try{
$sql = "DELETE FROM #--actions_roles WHERE id_role=".$this->eq($id_role);
return true;
}
- function clear_role_users($id_role){
+ public function clear_role_users($id_role){
$sgbd = $this->sgbd();
try{
$sql = "DELETE FROM #--users_roles WHERE id_role=".$this->eq($id_role);
return true;
}
- function add_role_action($id_role, $action){
+ public function add_role_action($id_role, $action){
$sgbd = $this->sgbd();
try{
$sql = "INSERT INTO #--actions_roles(action, id_role) VALUES(".$this->eq($action).", ".$this->eq($id_role).")";
return $id_action_role;
}
- function del_role($id_role){
+ public function del_role($id_role){
$sgbd = $this->sgbd();
try{
$sql = "DELETE FROM #--roles WHERE id=".$this->eq($id_role);
return true;
}
- function get_user_roles(){
+ public function get_user_roles(){
$user_roles = array();
$user = $this->get_session_user();
if($user && isset($user["id"])){
return $user_roles;
}
- function init_actions_roles(){
+ public function init_actions_roles(){
if(!isset($this->roles)) return false;
$this->actions_roles = $this->read_actions_roles();
return $this->actions_roles;
}
- function read_actions_roles($params = array()){
+ public function read_actions_roles($params = array()){
$group_by_action = isset($params["group_by_action"]) ? $params["group_by_action"] : false;
$sgbd = $this->sgbd();
$actions_roles = array();
return $actions_roles;
}
- function get_action_roles($mod, $controller = "index", $action = "index"){
+ public function get_action_roles($mod, $controller = "index", $action = "index"){
$sgbd = $this->sgbd();
$roles = array();
try{
return $roles;
}
- function get_actions($id_role = null){
+ public function get_actions($id_role = null){
$env = $this->env();
if($actions = $env->get_actions()){
if(($actions_roles = $this->read_actions_roles(array("group_by_action" => true))) !== false){
}
}
-
-?>
\ No newline at end of file