noalyss Version-9
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions
Noalyss_User Class Reference

Data & function about connected users. More...

+ Collaboration diagram for Noalyss_User:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 
 __toString ()
 
 Admin ()
 synomym for isAdmin, More...
 
 audit ($action='AUDIT', $p_module="")
 
 can_add_action ($p_profile)
 Check if the current user can add an action in the profile given in parameter. More...
 
 can_connect ()
 check the password and user More...
 
 can_delete_action ($dtoc)
 Check if the profile of the user can write AND delete for this profile. More...
 
 can_print ($p_action, $p_js=0)
 
 can_read_action ($dtoc)
 Check if the profile of the user can write for this profile. More...
 
 can_read_repo ($p_repo)
 Check if the profile of the user can read for this repository. More...
 
 can_request ($p_action, $p_js=0)
 
 can_write_action ($dtoc)
 Check if the profile of the user can write for this profile. More...
 
 can_write_repo ($p_repo)
 Check if the profile of the user can write for this repository. More...
 
 Check ($silent=false, $from='')
 Check if user is active and exists in therepository Automatically redirect, it doesn't check if a user can access a folder. More...
 
 check_action ($p_action_id)
 Check if an user is allowed to do an action. More...
 
 check_dossier ($p_dossier_id, $silent=false)
 check if an user can access a folder, if he cannot display a dialog box and exit More...
 
 check_jrn ($p_jrn)
 check the access of an user on a ledger More...
 
 check_module ($p_module)
 Check if an user can access a module, return 1 if yes, otherwise 0 record in audit log This function works only if user is connected to a Folder. More...
 
 check_print ($p_action)
 Check if the user can print (in menu_ref p_type_display=p) otherwise warn and exit. More...
 
 get_access_mode ()
 access_mode tells what mode must be used : pc or mobile More...
 
 get_available_folder ($p_filter="")
 Get all the available folders for the users, checked with the security. More...
 
 get_available_repository ($p_access='R')
 return array of available repository More...
 
 get_exercice ()
 
 get_first_week_day ()
 
 get_folder_access ($p_dossier=0)
 return the access to a folder, More...
 
 get_ledger ($p_type='ALL', $p_access=3, $disable=TRUE)
 get all the available ledgers for the current user More...
 
 get_ledger_access ($p_ledger)
 check that a user is valid and the access to the folder More...
 
 get_ledger_sql ($p_type='ALL', $p_access=3)
 return an sql condition for filtering the permitted ledger More...
 
 get_limit_current_exercice ()
 return the first date and the last date of the current exercice for the current user More...
 
 get_mini_report ()
 return the mini rapport to display on the welcome page More...
 
 get_periode ()
 Get the default periode from the user's preferences. More...
 
 get_preference ()
 Get the default user's preferences. More...
 
 get_profile ()
 return the profile (p_id) More...
 
 get_readable_profile ()
 return array of readable action_profile More...
 
 get_status_security_action ()
 Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled, otherwise 0. More...
 
 get_status_security_ledger ()
 Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled, otherwise 0. More...
 
 get_writable_profile ()
 return array of writable action_profile More...
 
 getActive ()
 
 getAdmin ()
 
 getDb ()
 
 getEmail ()
 
 getFirstName ()
 
 getId ()
 
 getLogin ()
 
 getName ()
 
 getPassword ()
 
 getValid ()
 
 insert ()
 
 insert_default_global_pref ($p_type="", $p_value="")
 insert default pref if no parameter are given insert all the existing parameter otherwise only the requested More...
 
 is_local_admin ($p_dossier=-1)
 Check if an user is an local administrator. More...
 
 isAdmin ()
 Check if an user is an admin and check also his password. More...
 
 load ()
 
 load_global_pref ()
 Get the global preferences from user_global_pref in the account_repository db. More...
 
 password_to_session ()
 store the password in session More...
 
 save ()
 
 save_email ($p_email)
 Save the password from PREFERENCE MODULE. More...
 
 save_global_preference ($key, $value)
 Save the preference , the scope is global, the settings are saved into account_repository. More...
 
 save_password ($p_pass1, $p_pass2)
 Save the password of the current user. More...
 
 save_profile ($p_id)
 
 set_access_mode ($access_mode)
 access_mode tells what mode must be used : pc or mobile More...
 
 set_folder_access ($db_id, $priv)
 save the access of a folder More...
 
 set_mini_report ($p_id)
 set the mini rapport to display on the welcome page More...
 
 set_periode ($p_periode)
 Set the selected periode in the user's preferences. More...
 
 set_session_var ()
 put user_login into Postgres config (session), it can be used for tracking users activities More...
 
 set_status_security_action ($p_value)
 Set the flag in the table user_active_security. More...
 
 set_status_security_ledger ($p_value)
 Set the flag in the table user_active_security. More...
 
 setActive ($active)
 
 setAdmin ($admin)
 
 setDb ($db)
 
 setEmail ($email)
 
 setFirstName ($first_name)
 
 setId (int $id)
 
 setLogin (string $login)
 
 setName ($name)
 
 setPassword ($password)
 
 setValid (int $valid)
 
 show_dossier ($p_filtre="")
 Show all the available folder for the users at the login page. More...
 
 sql_readable_profile ()
 Compute the SQL string for the readable profile, the subselect for p_id , example p_id in $g_user->sql_readable_profile. More...
 
 sql_writable_profile ()
 Compute the SQL string for the writable profile, the subselect for p_id , example p_id in $g_user->sql_writable_profile. More...
 
 update_global_pref ($p_type, $p_value="")
 update default pref if value is not given then use the default value More...
 

Static Public Member Functions

static audit_admin ($p_module)
 Audit action from the administration menu. More...
 
static clean_session ()
 clean the sessions More...
 
static get_list ($p_dossier)
 return an array with all the active users who can access $p_dossier including the global admin. More...
 
static grant_admin_access ($p_login, $p_dossier)
 Grant access to folder, grant administrator profile , all the ledgers and all the action. More...
 
static remove_inexistant_user ($p_dossier)
 
static revoke_access ($p_login, $p_dossier)
 Remove a user and all his privileges So it cannot connect anymore and all his privileges are removed from the dossier. More...
 

Data Fields

 $access_mode
 MOBILE or PC depending if when connecting $login contains @mobile. More...
 
 $active
 1 active , 0 disables More...
 
 $admin
 is or is not admin More...
 
 $db
 database connx to the folder NOT repository More...
 
 $email
 user's email More...
 
 $first_name
 
 $id
 in account_repository , ac_users.use_id More...
 
 $lang
 user's language More...
 
 $last_name
 user's last_name More...
 
 $login
 login lower case More...
 
 $name
 
 $password
 md5 of the password More...
 
 $theme
 user's CSS Theme More...
 
 $valid
 is or is not valid More...
 

Private Member Functions

 connect_user ()
 connect the user and set the $_SESSION variables if not set thanks the $_REQUEST
More...
 
 set_default_periode ()
 

Detailed Description

Data & function about connected users.

Definition at line 33 of file noalyss_user.class.php.

Constructor & Destructor Documentation

◆ __construct()

Noalyss_User::__construct (   $p_cn,
  $p_id = -1 
)

Definition at line 52 of file noalyss_user.class.php.

53 {
54 $this->db=$p_cn;
55 // if p_id is not set then check the connected user
56 if ($p_id==-1)
57 {
58 $this->connect_user();
59 $this->set_session_var();
60 }
61 else // if p_id is set get data of another user
62 {
63 $this->id=$p_id;
64 $this->load();
65 }
66 }
set_session_var()
put user_login into Postgres config (session), it can be used for tracking users activities
connect_user()
connect the user and set the $_SESSION variables if not set thanks the $_REQUEST
$SecUser db

References $p_id, connect_user(), db, load(), and set_session_var().

+ Here is the call graph for this function:

Member Function Documentation

◆ __toString()

Noalyss_User::__toString ( )

Definition at line 78 of file noalyss_user.class.php.

78 : string
79 {
80 return "User ".print_r($this,true);
81 }

◆ Admin()

Noalyss_User::Admin ( )

synomym for isAdmin,

Deprecated:

Definition at line 663 of file noalyss_user.class.php.

663 :int
664 {
665 return $this->isAdmin();
666 }
isAdmin()
Check if an user is an admin and check also his password.

◆ audit()

Noalyss_User::audit (   $action = 'AUDIT',
  $p_module = "" 
)

Definition at line 1399 of file noalyss_user.class.php.

1400 {
1401 global $audit;
1402 if ($audit)
1403 {
1404 if ($p_module==""&&isset($_REQUEST['ac']))
1405 {
1406 $p_module=$_REQUEST['ac'];
1407 }
1408 $cn=new Database();
1409 if (isset($_REQUEST['gDossier']))
1410 $p_module.=" dossier : ".$_REQUEST['gDossier'];
1411 $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
1412
1413 $cn->exec_sql($sql,
1414 array(
1415 $_SESSION[SESSION_KEY.'g_user'],
1416 $_SERVER["REMOTE_ADDR"],
1417 $p_module,
1418 $_SERVER['REQUEST_URI'],
1419 $action));
1420 }
1421 }
$action
$_REQUEST['ac']
contains the class for connecting to Noalyss
global $audit

◆ audit_admin()

static Noalyss_User::audit_admin (   $p_module)
static

Audit action from the administration menu.

Parameters
$p_moduledescription of the action

Definition at line 1385 of file noalyss_user.class.php.

1386 {
1387 $cn=new Database();
1388 $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
1389
1390 $cn->exec_sql($sql,
1391 array(
1392 $_SESSION[SESSION_KEY.'g_user'],
1393 $_SERVER["REMOTE_ADDR"],
1394 $p_module,
1395 $_SERVER['REQUEST_URI'],
1396 'ADMIN'));
1397 }

◆ can_add_action()

Noalyss_User::can_add_action (   $p_profile)

Check if the current user can add an action in the profile given in parameter.

Parameters
type$p_profileprofile.p_id = action_gestion.ag_dest
Returns
boolean

Definition at line 1518 of file noalyss_user.class.php.

1519 {
1520 $r=$this->db->get_value(' select count(*)
1521 from user_sec_action_profile
1522 where p_granted=$2
1523 and p_id=$1', array($this->get_profile(), $p_profile));
1524 if ($r==0)
1525 {
1526 return false;
1527 }
1528 return true;
1529 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
get_profile()
return the profile (p_id)

◆ can_connect()

Noalyss_User::can_connect ( )

check the password and user

Definition at line 85 of file noalyss_user.class.php.

86 {
87 $cn=new \Database();
88 $can_connect=$cn->get_value("select count(*) from ac_users
89 where use_active=1 and
90 use_login=$1 and use_pass=$2",
91 [$this->login,$this->password]);
92 return $can_connect;
93 }

References $cn.

Referenced by Check(), and connect_user().

◆ can_delete_action()

Noalyss_User::can_delete_action (   $dtoc)

Check if the profile of the user can write AND delete for this profile.

Parameters
$dtocaction_gestion.ag_id
Returns
true if he can write otherwise false

Definition at line 1555 of file noalyss_user.class.php.

1556 {
1557 if ($this->Admin()==1)
1558 return TRUE;
1559 if ($this->get_status_security_action()==0)
1560 return TRUE;
1561 $profile=$this->get_profile();
1562 $r=$this->db->get_value(" select count(*) from action_gestion where ag_id=$1 and ag_dest in
1563 (select p_granted from user_sec_action_profile where ua_right='W' and p_id=$2) ", array($dtoc, $profile));
1564 if ($r==0)
1565 return FALSE;
1566 return true;
1567 }
get_status_security_action()
Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled,...
Admin()
synomym for isAdmin,

◆ can_print()

Noalyss_User::can_print (   $p_action,
  $p_js = 0 
)

Definition at line 1098 of file noalyss_user.class.php.

1099 {
1100 if ($this->check_print($p_action)==0)
1101 {
1102 $this->audit('FAIL');
1103 if ($p_js==1)
1104 {
1105 echo create_script("alert_box(content[59])");
1106 }
1107 else
1108 {
1109 echo '<div class="redcontent">';
1110 echo '<h2 class="error">',
1111 htmlspecialchars(_("Cette action ne vous est pas autorisée Contactez votre responsable")),
1112 '</h2>';
1113 echo '</div>';
1114 }
1115 exit(-1);
1116 }
1117 }
if(! isset($_GET['submit_query'])) $p_action
audit($action='AUDIT', $p_module="")
check_print($p_action)
Check if the user can print (in menu_ref p_type_display=p) otherwise warn and exit.
for($e=0; $e< count($afiche); $e++) exit
create_script($p_string)
create the HTML for adding the script tags around of the script

◆ can_read_action()

Noalyss_User::can_read_action (   $dtoc)

Check if the profile of the user can write for this profile.

Parameters
$dtocaction_gestion.ag_id
Returns
true if he can write otherwise false

Definition at line 1574 of file noalyss_user.class.php.

1575 {
1576 if ($this->Admin()==1)
1577 return true;
1578 $profile=$this->get_profile();
1579 $r=$this->db->get_value(" select count(*) from action_gestion where ag_id=$1 and (ag_dest in
1580 (select p_granted from user_sec_action_profile where p_id=$2) or ag_owner=$3)",
1581 array($dtoc, $profile, $this->login));
1582 if ($r==0)
1583 return false;
1584 return true;
1585 }

◆ can_read_repo()

Noalyss_User::can_read_repo (   $p_repo)

Check if the profile of the user can read for this repository.

Parameters
$p_repostock_repository.r_id
Returns
true if he read write otherwise false

Definition at line 1613 of file noalyss_user.class.php.

1614 {
1615 if ($this->Admin()==1)
1616 return true;
1617 $profile=$this->get_profile();
1618 $r=$this->db->get_value("select count(*)
1619 from profile_sec_repository
1620 where
1621 r_id=$1
1622 and p_id =$2
1623 ", array($p_repo, $profile));
1624 if ($r==0)
1625 return false;
1626 return true;
1627 }

◆ can_request()

Noalyss_User::can_request (   $p_action,
  $p_js = 0 
)

Definition at line 1049 of file noalyss_user.class.php.

1050 {
1051 if ($this->check_action($p_action)==0)
1052 {
1053 $this->audit('FAIL');
1054 if ($p_js==1)
1055 {
1056 echo create_script("alert_box(content[59])");
1057 }
1058 elseif ($p_js==2)
1059 {
1060 record_log(_("Access invalid").$p_action);
1061 }
1062 else
1063 {
1064 echo '<h2 class="error">',
1065 htmlspecialchars(_("Cette action ne vous est pas autorisée Contactez votre responsable")),
1066 '</h2>';
1067 echo '</div>';
1068 }
1069 exit(-1);
1070 }
1071 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342
check_action($p_action_id)
Check if an user is allowed to do an action.
if( $delta< 0) elseif( $delta==0)

◆ can_write_action()

Noalyss_User::can_write_action (   $dtoc)

Check if the profile of the user can write for this profile.

Parameters
$dtocaction_gestion.ag_id
Returns
true if he can write otherwise false

Definition at line 1536 of file noalyss_user.class.php.

1537 {
1538 if ($this->Admin()==1)
1539 return TRUE;
1540 if ($this->get_status_security_action()==0)
1541 return TRUE;
1542 $profile=$this->get_profile();
1543 $r=$this->db->get_value(" select count(*) from action_gestion where ag_id=$1 and ag_dest in
1544 (select p_granted from user_sec_action_profile where ua_right in ('W','O') and p_id=$2) ", array($dtoc, $profile));
1545 if ($r==0)
1546 return FALSE;
1547 return true;
1548 }

◆ can_write_repo()

Noalyss_User::can_write_repo (   $p_repo)

Check if the profile of the user can write for this repository.

Parameters
$p_repostock_repository.r_id
Returns
true if he can write otherwise false

Definition at line 1592 of file noalyss_user.class.php.

1593 {
1594 if ($this->Admin()==1)
1595 return true;
1596 $profile=$this->get_profile();
1597 $r=$this->db->get_value("select count(*)
1598 from profile_sec_repository
1599 where
1600 r_id=$1
1601 and p_id =$2
1602 and ur_right='W'", array($p_repo, $profile));
1603 if ($r==0)
1604 return false;
1605 return true;
1606 }

◆ Check()

Noalyss_User::Check (   $silent = false,
  $from = '' 
)

Check if user is active and exists in therepository Automatically redirect, it doesn't check if a user can access a folder.

Parameters
$silentfalse, echo an error message and exit, true : exit without warning default is false

++

Definition at line 424 of file noalyss_user.class.php.

425 {
426
427 $res=0;
428 $pass5=$this->password;
429
430 $cn=new Database();
431 $sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass,
432 use_admin,use_first_name,use_name
433 from ac_users
434 where ac_users.use_id=$1
435 and ac_users.use_active=1
436 and ac_users.use_pass=$2";
437 $ret=$cn->exec_sql($sql, array($this->id, $pass5));
439 if ($res>0)
440 {
442 $_SESSION[SESSION_KEY.'use_admin']=$r['use_admin'];
443 $_SESSION[SESSION_KEY.'use_name']=$r['use_name'];
444 $_SESSION[SESSION_KEY.'use_first_name']=$r['use_first_name'];
445 $_SESSION[SESSION_KEY.'isValid']=1;
446
447 $this->admin=$_SESSION[SESSION_KEY.'use_admin'];
448 $this->name=$_SESSION[SESSION_KEY.'use_name'];
449 $this->first_name=$_SESSION[SESSION_KEY.'use_first_name'];
450 $this->load_global_pref();
451 }
452 $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
453
454 if ($res==0 || $this->can_connect() == 0)
455 {
456 $cn->exec_sql($sql,
457 array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"],
458 $from, $_SERVER['REQUEST_URI'], 'FAIL'));
459 if (!$silent)
460 {
461 echo '<script> alert(\''._('Utilisateur ou mot de passe incorrect').'\')</script>';
462 redirect('index.html');
463 }
464 $this->valid=0;
465 session_unset();
466 exit-1;
467 }
468 else
469 {
470 if ($from=='LOGIN' || $from=='PORTAL')
471 {
472 $cn->exec_sql($sql,
473 array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $from,
474 $_SERVER['REQUEST_URI'], 'SUCCESS'));
475 }
476 $this->valid=1;
477 }
478
479 return $ret;
480 }
$from
Definition: balance.inc.php:61
$from_poste name
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
$password
md5 of the password
load_global_pref()
Get the global preferences from user_global_pref in the account_repository db.
can_connect()
check the password and user

References $cn, $from, $password, $r, $res, $ret, $sql, can_connect(), DatabaseCore\fetch_array(), load_global_pref(), name, and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ check_action()

Noalyss_User::check_action (   $p_action_id)

Check if an user is allowed to do an action.

Parameters
p_action_id
Returns
  • 0 no priv

Definition at line 871 of file noalyss_user.class.php.

872 {
873 /* save it into the log */
874 global $audit;
875 if ($this->Admin()==1)
876 return 1;
877 if ($this->is_local_admin(dossier::id())==1)
878 return 1;
879 if ($this->get_status_security_action()==0)
880 return 1;
881 $Res=$this->db->exec_sql(
882 "select * from user_sec_act where ua_login=$1 and ua_act_id=$2", array($this->login, $p_action_id));
883 $Count=Database::num_row($Res);
884 if ($Count==0)
885 {
886 if (isset($audit)&&$audit==true)
887 {
888 $cn=new Database();
889 $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
890 $cn->exec_sql($sql,
891 array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $p_action_id, $_SERVER['REQUEST_URI'],
892 'FAIL'));
893 }
894 return 0;
895 }
896 if ($Count==1)
897 return 1;
898 echo_error(_("Action invalide"));
899 record_log("User:check_action".sprintf("login %s ua_act_id %s", $this->login, $p_action_id));
900 exit();
901 }
echo_error($p_log, $p_line="", $p_message="")
log error into the /tmp/noalyss_error.log it doesn't work on windows
Definition: ac_common.php:169
$input_from id
Definition: balance.inc.php:63
is_local_admin($p_dossier=-1)
Check if an user is an local administrator.
$Res

◆ check_dossier()

Noalyss_User::check_dossier (   $p_dossier_id,
  $silent = false 
)

check if an user can access a folder, if he cannot display a dialog box and exit

Parameters
thefolder if
$silentfalse, echo an error message and exit, true : exit without warning default is false
Returns
  • L for administrator (local and global)
  • X no access
  • R regular user

Definition at line 1228 of file noalyss_user.class.php.

1229 {
1230 $this->Admin();
1231 if ($this->admin==1||$this->is_local_admin($p_dossier_id)==1)
1232 return 'L';
1233 $cn=new Database();
1234
1235 $dossier=$cn->get_value("select 'R' from jnt_use_dos where dos_id=$1 and use_id=$2",
1236 array($p_dossier_id, $this->id));
1237 $dossier=($dossier=='')?'X':$dossier;
1238 if ($dossier=='X')
1239 {
1240 $this->audit('FAIL', "Access folder ");
1241 if (!$silent)
1242 {
1243 alert(_('Dossier non accessible'));
1244 exit();
1245 }
1246 }
1247 return $dossier;
1248 }
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
$dossier

◆ check_jrn()

Noalyss_User::check_jrn (   $p_jrn)

check the access of an user on a ledger

Parameters
$p_jrnthe ledger id
Returns
  • O only predefined operation
  • W write
  • R read only
  • X no access

Definition at line 1212 of file noalyss_user.class.php.

1213 {
1214 return $this->get_ledger_access($p_jrn);
1215 }
get_ledger_access($p_ledger)
check that a user is valid and the access to the folder

◆ check_module()

Noalyss_User::check_module (   $p_module)

Check if an user can access a module, return 1 if yes, otherwise 0 record in audit log This function works only if user is connected to a Folder.

Parameters
string$p_modulemenu_ref.me_code
Returns
0 for FORBIDDEN, 1 for GRANTED

Definition at line 842 of file noalyss_user.class.php.

843 {
844 if ( $this->access_mode == "PC") {
845
846 $acc=$this->db->get_value("select count(*) from v_all_menu where p_id = $1
847 and me_code=$2", array($this->get_profile(), $p_module));
848 } elseif ($this->access_mode=="MOBILE") {
849 $acc=$this->db->get_value("select count(*) from profile_mobile where p_id=$1 and me_code=$2",
850 array($this->get_profile(), $p_module));
851 } else {
852 throw new Exception("USER:823:ACCESS_MODE INCONNU");
853 }
854 if ($acc==0)
855 {
856 $this->audit("FAIL", $p_module);
857 return 0;
858 }
859 $this->audit("SUCCESS", $p_module);
860 return 1;
861 }

◆ check_print()

Noalyss_User::check_print (   $p_action)

Check if the user can print (in menu_ref p_type_display=p) otherwise warn and exit.

Parameters
$p_actionrequested action
Returns
nothing the program exits automatically

Definition at line 1079 of file noalyss_user.class.php.

1080 {
1081 global $audit, $cn;
1082 $this->audit('AUDIT', $p_action);
1083 if ($this->Admin()==1)
1084 return 1;
1085
1086 $res=$cn->get_value("select count(*) from profile_menu
1087 join profile_user using (p_id)
1088 where user_name=$1 and me_code=$2 ", array($this->login, $p_action));
1089 return $res;
1090 }

◆ clean_session()

static Noalyss_User::clean_session ( )
static

clean the sessions

Definition at line 1859 of file noalyss_user.class.php.

1860 {
1861
1862 $aSession=$_SESSION;
1863 foreach($aSession as $key => $value) {
1864 if(DEBUGNOALYSS>1) { echo "[$key]=>[$value]";}
1865
1866 if ( strpos($key,SESSION_KEY) === 0) {
1867 unset($_SESSION[$key]);
1868 if(DEBUGNOALYSS>1) { echo "=> [$key] cleaned";}
1869 }
1870 }
1871 }

References $value.

Referenced by connect_user().

◆ connect_user()

Noalyss_User::connect_user ( )
private

connect the user and set the $_SESSION variables if not set thanks the $_REQUEST

Definition at line 97 of file noalyss_user.class.php.

98 {
99 if (!isset($_SESSION[SESSION_KEY.'g_user']))
100 {
101 $http=new \HttpInput();
102 $user_login=$http->request("p_user", "string", "");
103 $user_password=$http->request("p_pass", "string", "");
104
105 if ($user_login!=""&&$user_password!="")
106 {
107 $_SESSION[SESSION_KEY."g_user"]=$user_login;
108 $_SESSION[SESSION_KEY."g_pass"]=md5($user_password);
109 }
110 else
111 {
112 echo '<h2 class="error">'._('Session expirée<br>Utilisateur déconnecté').'</h2>';
113 redirect('index.php', 1);
114 exit();
115 }
116
117
118 if (strpos($user_login, '@mobile')!=false)
119 {
120 $this->access_mode='MOBILE';
121 $this->login=str_ireplace("@mobile", "", $user_login);
122 }
123 else
124 {
125 $this->access_mode='PC';
126 $this->login=strtolower($user_login);
127 }
128
129 $_SESSION[SESSION_KEY."access_mode"]=$this->access_mode;
130 $_SESSION[SESSION_KEY.'g_user']=$this->login;
131 }
132 $this->login=$_SESSION[SESSION_KEY."g_user"];
133 $this->password=$_SESSION[SESSION_KEY.'g_pass'];
134
135 $this->id=-1;
136 $this->lang=(isset($_SESSION[SESSION_KEY.'g_lang']))?$_SESSION[SESSION_KEY.'g_lang']:'fr_FR.utf8';
137 $this->access_mode=$_SESSION[SESSION_KEY."access_mode"];
138 $cn=new Database();
139
140 // share user login with the repository
141 $cn->exec_sql(sprintf("select set_config('noalyss.user_login','%s',false)",
142 Database::escape_string($_SESSION[SESSION_KEY.'g_user'])));
143
144 if ($this->can_connect() == 0 || $this->load()==-1 )
145 {
146 echo '<h2 class="error">'._('Utilisateur ou mot de passe incorrect').'</h2>';
147 $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
148 $cn->exec_sql($sql,
149 array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], "DISCON",
150 $_SERVER['REQUEST_URI'], 'FAIL'));
151 $this->clean_session();
152 redirect('logout.php', 1);
153 exit();
154 }
155
156 $this->load_global_pref();
157
158 $_SESSION[SESSION_KEY.'g_lang']=$this->lang;
159 $this->valid=(isset($_SESSION[SESSION_KEY.'isValid']))?1:0;
160 if (isset($_SESSION[SESSION_KEY.'g_theme']))
161 {
162 $this->theme=$_SESSION[SESSION_KEY.'g_theme'];
163 }
164 $_SESSION[SESSION_KEY.'use_admin']=$this->admin;
165 $_SESSION[SESSION_KEY.'use_name']=$this->name;
166 $_SESSION[SESSION_KEY.'use_first_name']=$this->first_name;
167 }
static escape_string($p_string)
wrapper for the function pg_escape_string
$login
login lower case
$admin
is or is not admin
$lang
user's language
$access_mode
MOBILE or PC depending if when connecting $login contains @mobile.
static clean_session()
clean the sessions
$user_password
Definition: recover.php:80
redirect($p_string, $p_time=0)

References $access_mode, $admin, $cn, $first_name, $http, $lang, $login, $name, $sql, $user_password, can_connect(), clean_session(), DatabaseCore\escape_string(), exit, load(), load_global_pref(), and redirect().

Referenced by __construct().

+ Here is the call graph for this function:

◆ get_access_mode()

Noalyss_User::get_access_mode ( )

access_mode tells what mode must be used : pc or mobile

Definition at line 172 of file noalyss_user.class.php.

173 {
174 return $this->access_mode;
175 }

References $access_mode.

◆ get_available_folder()

Noalyss_User::get_available_folder (   $p_filter = "")

Get all the available folders for the users, checked with the security.

Parameters
$p_filter
Returns
array containing
  • ac_dossier.dos_id
  • ac_dossier.dos_name
  • ac_dossier.dos_description

Definition at line 1342 of file noalyss_user.class.php.

1343 {
1344 $cn=new Database();
1345 $filter="";
1346 if ($this->admin==0)
1347 {
1348 // show only available folders
1349 // if user is not an admin
1350 $Res=$cn->exec_sql("select
1351 distinct dos_id,dos_name,dos_description
1352 from ac_users
1353 natural join jnt_use_dos
1354 natural join ac_dossier
1355 where
1356 use_login= $1
1357 and use_active = 1
1358 and ( dos_name ilike '%' || $2 || '%' or dos_description ilike '%' || $2 || '%' )
1359 order by dos_name", array($this->login, $p_filter));
1360 }
1361 else
1362 {
1363 $Res=$cn->exec_sql("select
1364 distinct dos_id,dos_name,dos_description from ac_dossier
1365 where
1366 dos_name ilike '%' || $1|| '%' or dos_description ilike '%' || $1 || '%'
1367 order by dos_name", array($p_filter));
1368 }
1369
1371 if ($max==0)
1372 return 0;
1373
1374 for ($i=0; $i<$max; $i++)
1375 {
1377 }
1378 return $array;
1379 }
$filter

◆ get_available_repository()

Noalyss_User::get_available_repository (   $p_access = 'R')

return array of available repository

Parameters
$p_accessR for read W for write
Returns
an array

Definition at line 1142 of file noalyss_user.class.php.

1143 {
1144 $profile=$this->get_profile();
1145 $r=array();
1146 if ($p_access=='R')
1147 {
1148 $r=$this->db->get_array("select distinct u.r_id,r_name
1149 from
1150 profile_sec_repository as u
1151 join stock_repository as s on(u.r_id=s.r_id)
1152 where
1153 p_id =$1
1154 and ur_right='W'
1155 order by 2
1156 ", array($profile));
1157 }
1158 if ($p_access=='W')
1159 {
1160 $r=$this->db->get_array("select distinct u.r_id,r_name
1161 from
1162 profile_sec_repository as u
1163 join stock_repository as s on(u.r_id=s.r_id)
1164 where
1165 p_id =$1 order by 2
1166 ", array($profile));
1167 }
1168 return $r;
1169 }

◆ get_exercice()

Noalyss_User::get_exercice ( )

Definition at line 1029 of file noalyss_user.class.php.

1030 {
1031 $sql="select p_exercice from parm_periode where p_id=$1";
1032 $Ret=$this->db->exec_sql($sql,[$this->get_periode()]);
1033 if (Database::num_row($Ret)==1)
1034 {
1035 $r=Database::fetch_array($Ret, 0);
1036 return $r['p_exercice'];
1037 }
1038 else
1039 return 0;
1040 }
get_periode()
Get the default periode from the user's preferences.

◆ get_first_week_day()

Noalyss_User::get_first_week_day ( )

Definition at line 1844 of file noalyss_user.class.php.

1845 {
1846 $repocn=new Database();
1847 $result=$repocn->get_value("select parameter_value from user_global_pref where parameter_type=$1 and user_id=$2 ",
1848 array("first_week_day", $this->login));
1849 if ($repocn->count()==0)
1850 {
1851 $this->save_global_preference("first_week_day", 1);
1852 return 1;
1853 }
1854 return $result;
1855 }
save_global_preference($key, $value)
Save the preference , the scope is global, the settings are saved into account_repository.

References $result, and save_global_preference().

+ Here is the call graph for this function:

◆ get_folder_access()

Noalyss_User::get_folder_access (   $p_dossier = 0)

return the access to a folder,

Parameters
$p_dossierid if it is == 0 then we take the value from $_SESSION
Returns
the priv_priv
  • X no access
  • R has access (normal user)

Definition at line 491 of file noalyss_user.class.php.

492 {
493
494 if ($p_dossier==0)
495 $p_dossier=dossier::id();
496 if ($this->admin==1)
497 return 'R';
498 $cn=new Database();
499
500 $sql="select 'R' from jnt_use_dos where use_id=$1 and dos_id=$2";
501
502 $res=$cn->get_value($sql, array($this->id, $p_dossier));
503
504 if ($cn->get_affected()==0)
505 return 'X';
506 return $res;
507 }

◆ get_ledger()

Noalyss_User::get_ledger (   $p_type = 'ALL',
  $p_access = 3,
  $disable = TRUE 
)

get all the available ledgers for the current user

Parameters
$p_type= ALL or the type of the ledger (ACH,VEN,FIN,ODS)
$p_access=3 for Read or WRITE, 2 write, 1 for readonly
(boolean)$all if true show also inactive
Returns
a double array of available ledgers
[0] => [jrn_def_id]
[jrn_def_type]
[jrn_def_name]
[jrn_def_class_deb]
[jrn_def_class_cred]
[jrn_type_id]
[jrn_desc]
[uj_priv]

Definition at line 579 of file noalyss_user.class.php.

580 {
581 $p_type=strtoupper($p_type);
582 if (!in_array($p_type, ["FIN", "ALL", "ODS", "VEN", 'ACH']))
583 {
584 record_log(sprintf("UGL1, p_type %s", $p_type));
585 throw new Exception("UGL1"._("Type incorrecte"));
586 }
587 if ($disable==TRUE)
588 {
589 $sql_enable="";
590 }
591 else
592 {
593 $sql_enable="and jrn_enable=1";
594 }
595 if ($this->admin!=1&&$this->is_local_admin()!=1&&$this->get_status_security_ledger()==1)
596 {
597 $sql_type=($p_type=='ALL')?'':"and jrn_def_type=upper('".sql_string($p_type)."')";
598 switch ($p_access)
599 {
600 case 3:
601 $sql_access=" and uj_priv!= 'X' ";
602 break;
603 case 2:
604 $sql_access=" and uj_priv = 'W' and jrn_enable=1 ";
605 break;
606
607 case 1:
608 $sql_access=" and ( uj_priv = 'R' or uj_priv='W') ";
609 break;
610 }
611
612 $sql="select jrn_def_id,jrn_def_type,
613 jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
614 jrn_deb_max_line,jrn_cred_max_line,jrn_def_description,jrn_enable
615 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
616 join user_sec_jrn on uj_jrn_id=jrn_def_id
617 where
618 uj_login='".$this->login."'".
619 $sql_type.$sql_access.$sql_enable.
620 " order by jrn_Def_name";
621 }
622 else
623 {
624 $sql_type=($p_type=='ALL')?' '.$sql_enable:"where jrn_def_type=upper('".sql_string($p_type)."') ".$sql_enable;
625 $sql="select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
626 jrn_type_id,jrn_desc,'W' as uj_priv,jrn_def_description,jrn_enable
627 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
628 $sql_type
629 order by jrn_Def_name";
630 }
631 $res=$this->db->exec_sql($sql);
632 if (Database::num_row($res)==0)
633 return null;
635 return $array;
636 }
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition: ac_common.php:511
static fetch_all($ret)
wrapper for the function pg_fetch_all
get_status_security_ledger()
Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled,...

◆ get_ledger_access()

Noalyss_User::get_ledger_access (   $p_ledger)

check that a user is valid and the access to the folder

Parameters
$p_ledgerthe ledger to check
Returns
the priv_priv
  • O only predefined operation
  • W write
  • R read only
  • X no access

Definition at line 548 of file noalyss_user.class.php.

549 {
550 if ($this->admin==1||
551 $this->is_local_admin(dossier::id())==1||$this->get_status_security_ledger()==0)
552 return 'W';
553
554 $sql="select uj_priv from user_sec_jrn where uj_login=$1 and uj_jrn_id=$2";
555 $res=$this->db->get_value($sql, array($this->login, $p_ledger));
556
557 if ($res=='')
558 $res='X';
559 return $res;
560 }

◆ get_ledger_sql()

Noalyss_User::get_ledger_sql (   $p_type = 'ALL',
  $p_access = 3 
)

return an sql condition for filtering the permitted ledger

Parameters
$p_type= ALL or the type of the ledger (ACH,VEN,FIN,ODS)
$p_access=3 for READ or WRITE, 2 READ and write, 1 for readonly
Returns
sql condition like = jrn_def_id in (...)

Definition at line 645 of file noalyss_user.class.php.

646 {
647 $aLedger=$this->get_ledger($p_type, $p_access);
648 if (empty($aLedger))
649 return ' jrn_def_id < 0 ';
650 $sql=" jrn_def_id in (";
651 foreach ($aLedger as $row)
652 {
653 $sql.=$row['jrn_def_id'].',';
654 }
655 $sql.='-1)';
656 return $sql;
657 }
get_ledger($p_type='ALL', $p_access=3, $disable=TRUE)
get all the available ledgers for the current user

◆ get_limit_current_exercice()

Noalyss_User::get_limit_current_exercice ( )

return the first date and the last date of the current exercice for the current user

Returns
and array ([0] => start_date,[1] => end_date)

Definition at line 1254 of file noalyss_user.class.php.

1255 {
1257 $periode=new Periode($this->db);
1258 list($per_start, $per_end)=$periode->get_limit($current_exercice);
1259 $start=$per_start->first_day();
1260 $end=$per_end->last_day();
1261 return array($start, $end);
1262 }
For the periode tables parm_periode and jrn_periode.

◆ get_list()

static Noalyss_User::get_list (   $p_dossier)
static

return an array with all the active users who can access $p_dossier including the global admin.

The user must be activated

Parameters
$p_dossierdossier
Returns
an array of user's object array indices
  • use_id (id )
  • use_login (login of the user)
  • use_name
  • use_first_name
Exceptions
throwan exception if nobody can access

Definition at line 1186 of file noalyss_user.class.php.

1187 {
1188 $sql="select distinct use_id,use_login,use_first_name,use_name from ac_users
1189 left outer join jnt_use_dos using (use_id)
1190 where
1191 (dos_id=$1 and use_active=1) or (use_active=1 and use_admin=1)
1192 order by use_login,use_name";
1193
1194 $repo=new Database();
1195 $array=$repo->get_array($sql, array($p_dossier));
1196 if ($repo->size()==0)
1197 throw new Exception('Error inaccessible folder');
1198 return $array;
1199 }
if(isset($_REQUEST['gDossier']) && $http->request("gDossier","number", 0) !=0) $repo

◆ get_mini_report()

Noalyss_User::get_mini_report ( )

return the mini rapport to display on the welcome page

Returns
0 if nothing if found or the report to display (form_definition.fr_id)

Definition at line 753 of file noalyss_user.class.php.

754 {
755 $array=$this->get_preference();
756 $fr_id=(isset($array['MINIREPORT']))?$array['MINIREPORT']:0;
757 return $fr_id;
758 }
get_preference()
Get the default user's preferences.

◆ get_periode()

Noalyss_User::get_periode ( )

Get the default periode from the user's preferences.

Returns
the default periode

Definition at line 736 of file noalyss_user.class.php.

737 {
738
739 $array=$this->get_preference();
740 if (!isset($array['PERIODE']))
741 {
742 $this->set_default_periode();
743 $array=$this->get_preference();
744 }
745 return $array['PERIODE'];
746 }

◆ get_preference()

Noalyss_User::get_preference ( )

Get the default user's preferences.

Returns
array of (parameter_type => parameter_value)

Definition at line 810 of file noalyss_user.class.php.

811 {
812 $sql="select parameter_type,parameter_value from user_local_pref where user_id=$1";
813 $Res=$this->db->exec_sql($sql, array($this->id));
814 $l_array=array();
815 for ($i=0; $i<Database::num_row($Res); $i++)
816 {
818 $type=$row['parameter_type'];
819 $l_array[$type]=$row['parameter_value'];
820 }
821 $repo=new Database();
822 $a_global_pref=$repo->get_array("select parameter_type,parameter_value from user_global_pref
823 where
824 upper(user_id) = upper($1)", [$this->login]);
825 $nb_global=count($a_global_pref);
826 for ($i=0; $i<$nb_global; $i++)
827 {
828 $idx=$a_global_pref[$i]['parameter_type'];
829 $value=$a_global_pref[$i]['parameter_value'];
830 $l_array[$idx]=$value;
831 }
832
833 return $l_array;
834 }
$idx

◆ get_profile()

Noalyss_User::get_profile ( )

return the profile (p_id)

Returns
profile.p_id

Definition at line 1441 of file noalyss_user.class.php.

1442 {
1443 $profile=$this->db->get_value("select p_id from profile_user where
1444 lower(user_name)=lower($1) ", array($this->login));
1445 return $profile;
1446 }

◆ get_readable_profile()

Noalyss_User::get_readable_profile ( )

return array of readable action_profile

Definition at line 1484 of file noalyss_user.class.php.

1485 {
1486 $value=$this->db->get_array("select p_granted from ".$this->sql_readable_profile()." as m") ;
1487 $aGranted=array_column($value,"p_granted");
1488 return $aGranted;
1489 }
sql_readable_profile()
Compute the SQL string for the readable profile, the subselect for p_id , example p_id in $g_user->sq...

◆ get_status_security_action()

Noalyss_User::get_status_security_action ( )

Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled, otherwise 0.

Definition at line 1809 of file noalyss_user.class.php.

1810 {
1811 $security=$this->db->get_value("select us_action from user_active_security
1812 where
1813 us_login=$1", [$this->login]);
1814 $n_security=($security=="Y")?1:0;
1815 return $n_security;
1816 }

References db.

◆ get_status_security_ledger()

Noalyss_User::get_status_security_ledger ( )

Check the security on ledger for the user , it returns 1 if the security on ledgers is enabled, otherwise 0.

Definition at line 1773 of file noalyss_user.class.php.

1774 {
1775 $security=$this->db->get_value("select us_ledger from user_active_security
1776 where
1777 us_login=$1", [$this->login]);
1778 $n_security=($security=="Y")?1:0;
1779 return $n_security;
1780 }

References db.

◆ get_writable_profile()

Noalyss_User::get_writable_profile ( )

return array of writable action_profile

Definition at line 1474 of file noalyss_user.class.php.

1475 {
1476 $value=$this->db->get_array("select p_granted from ".$this->sql_writable_profile()." as m") ;
1477 $aGranted=array_column($value,"p_granted");
1478 return $aGranted;
1479 }
sql_writable_profile()
Compute the SQL string for the writable profile, the subselect for p_id , example p_id in $g_user->sq...

◆ getActive()

Noalyss_User::getActive ( )
Returns
mixed

Definition at line 285 of file noalyss_user.class.php.

286 {
287 return $this->active;
288 }
$active
1 active , 0 disables

References $active.

◆ getAdmin()

Noalyss_User::getAdmin ( )
Returns
default|int|mixed|string|string[]|null

Definition at line 221 of file noalyss_user.class.php.

222 {
223 return $this->admin;
224 }

References $admin.

◆ getDb()

Noalyss_User::getDb ( )
Returns
mixed

Definition at line 205 of file noalyss_user.class.php.

206 {
207 return $this->db;
208 }
$db
database connx to the folder NOT repository

References $db.

◆ getEmail()

Noalyss_User::getEmail ( )
Returns
mixed

Definition at line 333 of file noalyss_user.class.php.

334 {
335 return $this->email;
336 }
$email
user's email

References $email.

◆ getFirstName()

Noalyss_User::getFirstName ( )
Returns
default|mixed|string|string[]|null

Definition at line 253 of file noalyss_user.class.php.

254 {
255 return $this->first_name;
256 }

References $first_name.

◆ getId()

Noalyss_User::getId ( )
Returns
int|mixed

Definition at line 189 of file noalyss_user.class.php.

189 : int
190 {
191 return $this->id;
192 }
$id
in account_repository , ac_users.use_id

References $id.

◆ getLogin()

Noalyss_User::getLogin ( )
Returns
string

Definition at line 301 of file noalyss_user.class.php.

301 : string
302 {
303 return $this->login;
304 }

References $login.

◆ getName()

Noalyss_User::getName ( )
Returns
default|mixed|string|string[]|null

Definition at line 269 of file noalyss_user.class.php.

270 {
271 return $this->name;
272 }

References $name.

◆ getPassword()

Noalyss_User::getPassword ( )
Returns
mixed

Definition at line 317 of file noalyss_user.class.php.

318 {
319 return $this->password;
320 }

References $password.

◆ getValid()

Noalyss_User::getValid ( )
Returns
int

Definition at line 237 of file noalyss_user.class.php.

237 : int
238 {
239 return $this->valid;
240 }
$valid
is or is not valid

References $valid.

◆ grant_admin_access()

static Noalyss_User::grant_admin_access (   $p_login,
  $p_dossier 
)
static

Grant access to folder, grant administrator profile , all the ledgers and all the action.

Definition at line 1701 of file noalyss_user.class.php.

1702 {
1703 $repo_cnx=new Database();
1704 $user=$repo_cnx->get_array("select use_id,use_login
1705 from ac_users
1706 where use_login=$1", array($p_login));
1707
1708 if (!$user)
1709 return false;
1710 $cn_dossier=new Database($p_dossier);
1711 // if not access to DB
1712 if (
1713 $repo_cnx->get_value("select count(*) from jnt_use_dos where use_id=$1 and dos_id=$2",
1714 array($user[0]['use_id'], $p_dossier))==0
1715 )
1716 {
1717 $repo_cnx->exec_sql("insert into jnt_use_dos(use_id,dos_id) values ($1,$2)",
1718 array($user[0]['use_id'], $p_dossier));
1719 }
1720 //------ Give him the admin menu
1721 if ($cn_dossier->get_value("select count(*) from profile_user where user_name=$1", array($user[0]['use_login']))==0)
1722 {
1723 $cn_dossier->exec_sql('insert into profile_user(user_name,p_id) values($1,1)', array($user[0]['use_login']));
1724 }
1725 // Grant all action + ledger to him
1726 $cn_dossier->exec_sql("delete from user_sec_act where ua_login=$1", array($p_login));
1727
1728 $cn_dossier->exec_sql("insert into user_sec_act (ua_login,ua_act_id)"
1729 ." select $1 ,ac_id from action ", array($p_login));
1730
1731 $cn_dossier->exec_sql("delete from user_sec_jrn where uj_login=$1", array($p_login));
1732 $cn_dossier->exec_sql("insert into user_sec_jrn(uj_login,uj_jrn_id,uj_priv)"
1733 ." select $1,jrn_def_id,'W' from jrn_def", array($p_login));
1734 }

◆ insert()

Noalyss_User::insert ( )

Definition at line 403 of file noalyss_user.class.php.

404 {
405
406 $Sql="INSERT INTO ac_users(
407 use_first_name, use_name, use_login, use_active,
408 use_admin, use_pass, use_email)
409 VALUES ($1, $2, $3, $4, $5, $6, $7) returning use_id";
410
411 $cn=new Database();
412 $this->id=$cn->get_value($Sql,
413 array($this->first_name, $this->last_name, $this->login, 1, $this->admin,
414 $this->password, $this->email));
415 }

References $cn.

◆ insert_default_global_pref()

Noalyss_User::insert_default_global_pref (   $p_type = "",
  $p_value = "" 
)

insert default pref if no parameter are given insert all the existing parameter otherwise only the requested

Parameters
$p_typeparameter's type or nothing
$p_valueparameter value

Definition at line 961 of file noalyss_user.class.php.

962 {
963
964 $default_parameter=array("THEME"=>"classic",
965 "PAGESIZE"=>"50",
966 'TOPMENU'=>'TEXT',
967 'LANG'=>'fr_FR.utf8',
968 'csv_fieldsep'=>'0',
969 'csv_decimal'=>'0',
970 'csv_encoding'=>'utf8',
971 'first_week_day'=>1
972 );
973 $cn=new Database();
974 $sql="insert into user_global_pref(user_id,parameter_type,parameter_value)
975 values ($1,$2,$3)";
976 if ($p_type=="")
977 {
978 foreach ($default_parameter as $name=> $value)
979 {
980 $cn->exec_sql($sql, array($this->login, $name, $value));
981 }
982 }
983 else
984 {
985 $value=($p_value=="")?$default_parameter[$p_type]:$p_value;
986 if ( $cn->get_value("select count(*) from user_global_pref where user_id=$1 and parameter_type=$2",
987 array($this->login,$p_type)) == 1)
988 {
989 $cn->exec_sql("update user_global_pref set parameter_value=$1 where user_id=$2 and parameter_type=$3",
990 array($value,$this->login,$p_type));
991 } else {
992 $cn->exec_sql($sql, array($this->login, $p_type, $value));
993 }
994 }
995 }

◆ is_local_admin()

Noalyss_User::is_local_admin (   $p_dossier = -1)

Check if an user is an local administrator.

Deprecated:
since version 6.7
Parameters
$p_dossier: dossier_id
Returns
  • 0 if no
  • 1 if yes

Definition at line 1131 of file noalyss_user.class.php.

1132 {
1133 return 0;
1134 }

◆ isAdmin()

Noalyss_User::isAdmin ( )

Check if an user is an admin and check also his password.

Returns
1 for yes 0 for no

Definition at line 673 of file noalyss_user.class.php.

673 :int
674 {
675 $this->admin=0;
676 $pass5=$this->password;
677 $sql="select count(*) from ac_users where use_login=$1
678 and use_active=1 and use_admin=1 and use_pass=$2 ";
679
680 $cn=new Database();
681 $this->admin=$cn->get_value($sql, array($this->login,$pass5));
682 return $this->admin;
683 }

◆ load()

Noalyss_User::load ( )

Definition at line 352 of file noalyss_user.class.php.

352 :int
353 {
354 /* if this->id == -1, it is unknown so we have to retrieve it from
355 the database thanks it login */
356 if ($this->id<0)
357 {
358 $sql_cond=" where lower(use_login)=lower($1)";
359 $sql_array=array($this->login);
360 }
361 else
362 {
363 $sql_cond=" where use_id=$1";
364 $sql_array=array($this->id);
365 }
366 $sql="select use_id,
367 use_first_name,
368 use_name,
369 use_login,
370 use_active,
371 use_admin,
372 use_pass,
373 use_email
374 from ac_users ";
375 $cn=new Database();
376 $Res=$cn->exec_sql($sql.$sql_cond, $sql_array);
377 if (($Max=Database::num_row($Res))==0)
378 return -1;
380 $this->id=$row['use_id'];
381 $this->first_name=$row['use_first_name'];
382 $this->last_name=$row['use_name'];
383 $this->name=$row['use_name'];
384 $this->active=$row['use_active'];
385 $this->login=strtolower($row['use_login']);
386 $this->admin=$row['use_admin'];
387 $this->password=$row['use_pass'];
388 $this->email=$row['use_email'];
389 return $this->id;
390 }
$sql_array['query']

References $cn, $id, $Max, $Res, $row, $sql, $sql_array, DatabaseCore\fetch_array(), name, and DatabaseCore\num_row().

Referenced by __construct(), and connect_user().

+ Here is the call graph for this function:

◆ load_global_pref()

Noalyss_User::load_global_pref ( )

Get the global preferences from user_global_pref in the account_repository db.

Note
set $SESSION[g_variable]

Definition at line 909 of file noalyss_user.class.php.

910 {
911 $cn=new Database();
912 // Load everything in an array
913 $Res=$cn->exec_sql("select parameter_type,parameter_value from
914 user_global_pref
915 where user_id=$1", [$this->login]);
917 if ($Max==0)
918 {
920 $this->load_global_pref();
921 return;
922 }
923 // Load value into array
924 $line=array();
925 for ($i=0; $i<$Max; $i++)
926 {
928 $type=$row['parameter_type'];
929 $line[$type]=$row['parameter_value'];
930 }
931 // save array into g_ variable
932 $array_pref=array('g_theme'=>'THEME',
933 'g_pagesize'=>'PAGESIZE',
934 'g_topmenu'=>'TOPMENU',
935 'g_lang'=>'LANG',
936 'csv_fieldsep'=>'csv_fieldsep',
937 'csv_decimal'=>'csv_decimal',
938 'csv_encoding'=>'csv_encoding',
939 'first_week_day'=>'first_week_day');
940
941 foreach ($array_pref as $name=> $parameter)
942 {
943 if (!isset($line[$parameter]))
944 {
945 $this->insert_default_global_pref($parameter);
946 $this->load_global_pref();
947 return;
948 }
949 $_SESSION[SESSION_KEY.$name]=$line[$parameter];
950 }
951 }
insert_default_global_pref($p_type="", $p_value="")
insert default pref if no parameter are given insert all the existing parameter otherwise only the re...

Referenced by Check(), and connect_user().

◆ password_to_session()

Noalyss_User::password_to_session ( )

store the password in session

Definition at line 1631 of file noalyss_user.class.php.

1632 {
1633 $_SESSION[SESSION_KEY.'g_pass']=$this->getPassword();
1634 }

◆ remove_inexistant_user()

static Noalyss_User::remove_inexistant_user (   $p_dossier)
static

Definition at line 1736 of file noalyss_user.class.php.

1737 {
1738 $cnx_repo=new Database();
1739 $name=$cnx_repo->format_name($p_dossier, 'dos');
1740 if ($cnx_repo->exist_database($name)==0)
1741 return;
1742 $cnx_dossier=new Database($p_dossier);
1743 if ($cnx_dossier->exist_table('profile_user'))
1744 $a_user=$cnx_dossier->get_array('select user_name from profile_user');
1745 else
1746 return;
1747
1748 if (!$a_user)
1749 return;
1750 $nb=count($a_user);
1751 for ($i=0; $i<$nb; $i++)
1752 {
1753 if ($cnx_repo->get_value('select count(*) from ac_users where use_login=$1', array($a_user[$i]['user_name']))==0)
1754 {
1755 if ($cnx_dossier->exist_table('user_sec_jrn'))
1756 $cnx_dossier->exec_sql("delete from user_sec_jrn where uj_login=$1", array($a_user[$i]['user_name']));
1757 $cnx_dossier->exec_sql("delete from profile_user where user_name=$1", array($a_user[$i]['user_name']));
1758 if ($cnx_dossier->exist_table('user_sec_act'))
1759 $cnx_dossier->exec_sql("delete from user_sec_act where ua_login=$1", array($a_user[$i]['user_name']));
1760 if ($cnx_dossier->exist_table('user_sec_jrn'))
1761 $cnx_dossier->exec_sql("delete from user_sec_jrn where uj_login=$1", array($a_user[$i]['user_name']));
1762 if ($cnx_dossier->exist_table('user_active_security'))
1763 $cnx_dossier->exec_sql("delete from user_active_security where us_login=$1",
1764 array($a_user[$i]['user_name']));
1765 }
1766 }
1767 }

References $i, $name, and $nb.

◆ revoke_access()

static Noalyss_User::revoke_access (   $p_login,
  $p_dossier 
)
static

Remove a user and all his privileges So it cannot connect anymore and all his privileges are removed from the dossier.

Definition at line 1677 of file noalyss_user.class.php.

1678 {
1679 // connect to the repository
1680 $repo_cnx=new Database();
1681
1682 // Retrieve the user
1683 $user=$repo_cnx->get_array('select use_id,use_login from ac_users where use_login=$1', array($p_login));
1684 if (!$user)
1685 return false;
1686
1687 // remove him from jnt_use_dos
1688 $repo_cnx->exec_sql("delete from jnt_use_dos WHERE use_id=$1 and dos_id=$2",
1689 array($user[0]['use_id'], $p_dossier));
1690
1691 // Remove user from user's dossier
1692 $cn_dossier=new Database($p_dossier);
1693 $cn_dossier->exec_sql("delete from profile_user where user_name=$1", array($p_login));
1694 $cn_dossier->exec_sql("delete from user_sec_act where ua_login=$1", array($p_login));
1695 }

◆ save()

Noalyss_User::save ( )

Definition at line 392 of file noalyss_user.class.php.

393 {
394
395 $Sql="update ac_users set use_first_name=$1, use_name=$2
396 ,use_active=$3,use_admin=$4,use_pass=$5 ,use_email = $7 where use_id=$6";
397 $cn=new Database();
398 $Res=$cn->exec_sql($Sql,
399 array($this->first_name, $this->last_name, $this->active, $this->admin, $this->password,
400 $this->id, $this->email));
401 }

References $cn, and $Res.

◆ save_email()

Noalyss_User::save_email (   $p_email)

Save the password from PREFERENCE MODULE.

Parameters
type$p_email

Definition at line 1664 of file noalyss_user.class.php.

1665 {
1666 $repo=new Database();
1667 $repo->exec_sql("update ac_users set use_email=$1 where use_login=$2",
1668 array($p_email, $_SESSION[SESSION_KEY.'g_user']));
1669 }

◆ save_global_preference()

Noalyss_User::save_global_preference (   $key,
  $value 
)

Save the preference , the scope is global, the settings are saved into account_repository.

Parameters
$keyTHEME, LANG , PAGESIZE
$valuevalue of the key

Definition at line 786 of file noalyss_user.class.php.

787 {
788 $repo=new Database();
789 $count=$repo->get_value("select count(*)
790 from
791 user_global_pref
792 where
793 parameter_type=$1 and user_id=$2", array($key, $this->login));
794 if ($count==1)
795 {
796 $repo->exec_sql("update user_global_pref set parameter_value=$1
797 where parameter_type=$2 and user_id=$3", array($value, $key, $this->login));
798 }
799 elseif ($count==0)
800 {
801 $repo->exec_sql("insert into user_global_pref(user_id,parameter_type,parameter_value)
802 values($1,$2,$3)", array($this->login, $key, $value));
803 }
804 }
$count

Referenced by get_first_week_day().

◆ save_password()

Noalyss_User::save_password (   $p_pass1,
  $p_pass2 
)

Save the password of the current user.

Parameters
string$p_pass1password (clear)
string$p_pass2for confirming password (clear)
See also
check_password_strength()
Returns
true : password successfully changed otherwise false

Definition at line 1642 of file noalyss_user.class.php.

1643 {
1644 if ($p_pass1==$p_pass2 && count(check_password_strength($p_pass1)['msg'])==0)
1645 {
1646 $repo=new Database();
1647 $l_pass=md5($p_pass1);
1648 $this->setPassword($l_pass);
1649 $repo->exec_sql("update ac_users set use_pass=$1 where use_login=$2",
1650 array($l_pass, $this->login));
1651 return true;
1652 }
1653 else
1654 {
1655
1656 return false;
1657 }
1658 }
check_password_strength($password)
returns an double array with the error found and code , if the count is 0 then the password is very s...
Definition: ac_common.php:1700
setPassword($password)

◆ save_profile()

Noalyss_User::save_profile (   $p_id)

Definition at line 1423 of file noalyss_user.class.php.

1424 {
1425 $count=$this->db->get_value("select count(*) from profile_user where user_name=$1", array($this->login));
1426 if ($count==0)
1427 {
1428 $this->db->exec_sql("insert into profile_user(p_id,user_name)
1429 values ($1,$2)", array($p_id, $this->login));
1430 }
1431 else
1432 {
1433 $this->db->exec_sql("update profile_user set p_id=$1 where user_name=$2", array($p_id, $this->login));
1434 }
1435 }

◆ set_access_mode()

Noalyss_User::set_access_mode (   $access_mode)

access_mode tells what mode must be used : pc or mobile

Definition at line 180 of file noalyss_user.class.php.

180 : object
181 {
182 $this->access_mode=$access_mode;
183 return $this;
184 }

References $access_mode.

◆ set_default_periode()

Noalyss_User::set_default_periode ( )
private

Definition at line 698 of file noalyss_user.class.php.

699 {
700
701 /* get the first periode */
702 $sql='select min(p_id) as pid '
703 .' from parm_periode '
704 .' where p_closed = false and p_start = (select min(p_start) from parm_periode)';
705 $Res=$this->db->exec_sql($sql);
706
707 $pid=Database::fetch_result($Res, 0, 0);
708 /* if all the periode are closed, then we use the last closed period */
709 if ($pid==null)
710 {
711 $sql='select min(p_id) as pid '
712 .'from parm_periode '
713 .'where p_start = (select max(p_start) from parm_periode)';
714 $Res2=$this->db->exec_sql($sql);
715 $pid=Database::fetch_result($Res2, 0, 0);
716 if ($pid==null)
717 {
718 throw new Exception(_("Aucune période trouvéee !!!"));
719 }
720
721 $pid=Database::fetch_result($Res2, 0, 0);
722 }
723
724 $sql=sprintf("insert into user_local_pref (user_id,parameter_value,parameter_type)
725 values ('%s','%d','PERIODE')", $this->id, $pid);
726 $Res=$this->db->exec_sql($sql);
727 }
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all

◆ set_folder_access()

Noalyss_User::set_folder_access (   $db_id,
  $priv 
)

save the access of a folder

Parameters
$db_idthe dossier id
$privboolean, true then it is granted, false it is removed

Definition at line 514 of file noalyss_user.class.php.

515 {
516
517 $cn=new Database();
518 if ($priv)
519 {
520 // the access is granted
521 $jnt=$cn->get_value("select jnt_id from jnt_use_dos where dos_id=$1 and use_id=$2", array($db_id, $this->id));
522
523 if ($cn->size()==0)
524 {
525
526 $Res=$cn->exec_sql("insert into jnt_use_dos(dos_id,use_id) values($1,$2)", array($db_id, $this->id));
527 }
528 }
529 else
530 {
531 // Access is revoked
532 $cn->exec_sql('delete from jnt_use_dos where use_id = $1 and dos_id = $2 ', array($this->id, $db_id));
533 }
534 }
$priv
Definition: user_login.php:128

◆ set_mini_report()

Noalyss_User::set_mini_report (   $p_id)

set the mini rapport to display on the welcome page

Definition at line 763 of file noalyss_user.class.php.

764 {
765 $count=$this->db->get_value("select count(*) from user_local_pref where user_id=$1 and parameter_type=$2",
766 array($this->id, 'MINIREPORT'));
767 if ($count==1)
768 {
769 $sql="update user_local_pref set parameter_value=$1 where user_id=$2 and parameter_type='MINIREPORT'";
770 $Res=$this->db->exec_sql($sql, array($p_id, $this->id));
771 }
772 else
773 {
774 $sql="insert into user_local_pref (user_id,parameter_type,parameter_value)".
775 "values($1,'MINIREPORT',$2)";
776 $Res=$this->db->exec_sql($sql, array($this->id, $p_id));
777 }
778 }

◆ set_periode()

Noalyss_User::set_periode (   $p_periode)

Set the selected periode in the user's preferences.

Parameters
$p_periodeperiode
-$p_user

Definition at line 692 of file noalyss_user.class.php.

693 {
694 $sql="update user_local_pref set parameter_value=$1 where user_id=$2 and parameter_type='PERIODE'";
695 $Res=$this->db->exec_sql($sql, [$p_periode, $this->id]);
696 }

◆ set_session_var()

Noalyss_User::set_session_var ( )

put user_login into Postgres config (session), it can be used for tracking users activities

Returns
void

Definition at line 72 of file noalyss_user.class.php.

73 {
74 $this->db->exec_sql(sprintf("select set_config('noalyss.user_login','%s',false)",
75 Database::escape_string($_SESSION[SESSION_KEY.'g_user'])));
76
77 }

References db, and DatabaseCore\escape_string().

Referenced by __construct().

+ Here is the call graph for this function:

◆ set_status_security_action()

Noalyss_User::set_status_security_action (   $p_value)

Set the flag in the table user_active_security.

Parameters
int$p_value1==enable , 0 = disable @exceptions invalid value

Definition at line 1823 of file noalyss_user.class.php.

1824 {
1825 if ($p_value!=0&&$p_value!=1)
1826 throw new Exception(_("Valeur invalide"));
1827 $exist=$this->db->get_value("select count(*) from user_active_security where us_login=$1", [$this->login]);
1828 $flag=($p_value==1)?"Y":"N";
1829 if ($exist==0)
1830 {
1831 $this->db->exec_sql("insert into user_active_security (us_login,us_action,us_ledger) values ($1,$2,$3)",
1832 [$this->login, $flag, 'Y']);
1833 }
1834 else
1835 {
1836 $this->db->exec_sql("update user_active_security set us_action=$1 where us_login = $2",
1837 [$flag, $this->login]);
1838 }
1839 }
$flag
Definition: install.php:531

References $flag, and db.

◆ set_status_security_ledger()

Noalyss_User::set_status_security_ledger (   $p_value)

Set the flag in the table user_active_security.

Parameters
int$p_value1==enable , 0 = disable @exceptions invalid value

Definition at line 1787 of file noalyss_user.class.php.

1788 {
1789 if ($p_value!=0&&$p_value!=1)
1790 throw new Exception(_("Valeur invalide"));
1791 $exist=$this->db->get_value("select count(*) from user_active_security where us_login=$1", [$this->login]);
1792 $flag=($p_value==1)?"Y":"N";
1793 if ($exist==0)
1794 {
1795 $this->db->exec_sql("insert into user_active_security (us_login,us_ledger,us_action) values ($1,$2,$3)",
1796 [$this->login, $flag, 'Y']);
1797 }
1798 else
1799 {
1800 $this->db->exec_sql("update user_active_security set us_ledger=$1 where us_login = $2",
1801 [$flag, $this->login]);
1802 }
1803 }

References $flag, and db.

◆ setActive()

Noalyss_User::setActive (   $active)
Parameters
mixed$active

Definition at line 293 of file noalyss_user.class.php.

293 : void
294 {
295 $this->active=$active;
296 }

References $active.

◆ setAdmin()

Noalyss_User::setAdmin (   $admin)
Parameters
default | int | mixed | string | string[] | null$admin

Definition at line 229 of file noalyss_user.class.php.

229 : void
230 {
231 $this->admin=$admin;
232 }

References $admin.

◆ setDb()

Noalyss_User::setDb (   $db)
Parameters
mixed$db

Definition at line 213 of file noalyss_user.class.php.

213 : void
214 {
215 $this->db=$db;
216 }

References $db, and db.

◆ setEmail()

Noalyss_User::setEmail (   $email)
Parameters
mixed$email

Definition at line 341 of file noalyss_user.class.php.

341 : void
342 {
343 $this->email=$email;
344 }

References $email.

◆ setFirstName()

Noalyss_User::setFirstName (   $first_name)
Parameters
default | mixed | string | string[] | null$first_name

Definition at line 261 of file noalyss_user.class.php.

261 : void
262 {
263 $this->first_name=$first_name;
264 }

References $first_name.

◆ setId()

Noalyss_User::setId ( int  $id)
Parameters
int | mixed$id

Definition at line 197 of file noalyss_user.class.php.

197 : void
198 {
199 $this->id=$id;
200 }

References $id.

◆ setLogin()

Noalyss_User::setLogin ( string  $login)
Parameters
string$login

Definition at line 309 of file noalyss_user.class.php.

309 : void
310 {
311 $this->login=$login;
312 }

References $login.

◆ setName()

Noalyss_User::setName (   $name)
Parameters
default | mixed | string | string[] | null$name

Definition at line 277 of file noalyss_user.class.php.

277 : void
278 {
279 $this->name=$name;
280 }

References $name, and name.

◆ setPassword()

Noalyss_User::setPassword (   $password)
Parameters
mixed$password

Definition at line 325 of file noalyss_user.class.php.

325 : void
326 {
327 $this->password=$password;
328 }

References $password.

◆ setValid()

Noalyss_User::setValid ( int  $valid)
Parameters
int$valid

Definition at line 245 of file noalyss_user.class.php.

245 : void
246 {
247 $this->valid=$valid;
248 }

References $valid.

◆ show_dossier()

Noalyss_User::show_dossier (   $p_filtre = "")

Show all the available folder for the users at the login page.

For the special case 'E' go directly to extension and bypasse the dashboard

Parameters
$p_filtreuser
Returns
table in HTML

Definition at line 1273 of file noalyss_user.class.php.

1274 {
1275 $p_array=$this->get_available_folder($p_filtre);
1276
1277 $result="";
1278
1279 $result.="<TABLE id=\"folder\" class=\"result\">";
1280 $result.="<tr>";
1281 $result.="<th>";
1282 $result.=_("Id");
1283 $result.="</th>";
1284 $result.="<th>";
1285 $result.=_("Nom");
1286 $result.="</th>";
1287 $result.="<th>";
1288 $result.=_("Description");
1289 $result.="</th>";
1290 $result.="</tr>";
1291 if ($p_array==0)
1292 {
1293 $result.="<tr>";
1294 $result.='<td style="width:auto" colspan=3>';
1295 $result.=_("Aucun dossier disponible");
1296 $result.='</td>';
1297 $result.="</tr>";
1298 return $result;
1299 }
1300
1301 for ($i=0; $i<sizeof($p_array); $i++)
1302 {
1303
1304 $id=$p_array[$i]['dos_id'];
1305 $name=$p_array[$i]['dos_name'];
1306 $desc=$p_array[$i]['dos_description'];
1307 if ($i%2==0)
1308 $tr="odd";
1309 else
1310 $tr="even";
1311 $target="do.php?gDossier=$id";
1312
1313 $result.="<TR class=\"$tr\">";
1314
1315 $result.=td($id, ' class="num" ');
1316 $result.="<TD class=\"$tr\">";
1317 $result.="<A class=\"dossier\" HREF=\"$target\">";
1318 $result.=" <B>".h($name)."</B>";
1319 $result.="</A>";
1320 $result.="</TD>";
1321 $desc=($desc=="")?"<i>Aucune description</i>":h($desc);
1322 $desc="<A class=\"dossier\" HREF=\"$target\">$desc</A>";
1323 $result.="<TD class=\"$tr\" >".$desc;
1324 $result.="</TD>";
1325 $result.="</TR>";
1326 }
1327 $result.="</TABLE>";
1328 return $result;
1329 }
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
h( $row[ 'oa_description'])
get_available_folder($p_filter="")
Get all the available folders for the users, checked with the security.

◆ sql_readable_profile()

Noalyss_User::sql_readable_profile ( )

Compute the SQL string for the readable profile, the subselect for p_id , example p_id in $g_user->sql_readable_profile.

The administrator can read all the profiles

Returns
SQL string with the subselect for p_id

Definition at line 1497 of file noalyss_user.class.php.

1498 {
1499 if ($this->admin!=1)
1500 {
1501 $sql=" (select p_granted "
1502 ." from user_sec_action_profile "
1503 ." where ua_right in ('W','R','O') and p_id=".$this->get_profile().") ";
1504 }
1505 else
1506 {
1507 $sql="(select p_id p_granted from profile)";
1508 }
1509 return $sql;
1510 }

◆ sql_writable_profile()

Noalyss_User::sql_writable_profile ( )

Compute the SQL string for the writable profile, the subselect for p_id , example p_id in $g_user->sql_writable_profile.

The administrator can access all the profiles R = Read Only W = Write and delete O = write and not delete

Returns
SQL string with the subselect for p_id

Definition at line 1456 of file noalyss_user.class.php.

1457 {
1458 if ($this->admin!=1)
1459 {
1460 $sql=" (select p_granted "
1461 ." from user_sec_action_profile "
1462 ." where ua_right in ('W','O') and p_id=".$this->get_profile().") ";
1463 }
1464 else
1465 {
1466 $sql="(select p_id p_granted from profile)";
1467 }
1468 return $sql;
1469 }

◆ update_global_pref()

Noalyss_User::update_global_pref (   $p_type,
  $p_value = "" 
)

update default pref if value is not given then use the default value

Parameters
$p_typeparameter's type
$p_valueparameter's value value of the type

Definition at line 1004 of file noalyss_user.class.php.

1005 {
1006 $default_parameter=array("THEME"=>"classic",
1007 "PAGESIZE"=>"50",
1008 "LANG"=>'fr_FR.utf8',
1009 'TOPMENU'=>'SELECT',
1010 'csv_fieldsep'=>'0',
1011 'csv_decimal'=>'0',
1012 'csv_encoding'=>'utf8',
1013 'first_week_day'=>1
1014 );
1015 $cn=new Database();
1016 $Sql="update user_global_pref set parameter_value=$1
1017 where parameter_type=$2 and
1018 user_id=$3";
1019 $value=($p_value=="")?$default_parameter[$p_type]:$p_value;
1020 $cn->exec_sql($Sql, array($value, $p_type, $this->login));
1021 }

Field Documentation

◆ $access_mode

Noalyss_User::$access_mode

MOBILE or PC depending if when connecting $login contains @mobile.

Definition at line 48 of file noalyss_user.class.php.

Referenced by connect_user(), get_access_mode(), and set_access_mode().

◆ $active

Noalyss_User::$active

1 active , 0 disables

Definition at line 44 of file noalyss_user.class.php.

Referenced by getActive(), and setActive().

◆ $admin

Noalyss_User::$admin

is or is not admin

Definition at line 39 of file noalyss_user.class.php.

Referenced by connect_user(), getAdmin(), and setAdmin().

◆ $db

Noalyss_User::$db

database connx to the folder NOT repository

Definition at line 38 of file noalyss_user.class.php.

Referenced by getDb(), and setDb().

◆ $email

Noalyss_User::$email

user's email

Definition at line 47 of file noalyss_user.class.php.

Referenced by getEmail(), and setEmail().

◆ $first_name

Noalyss_User::$first_name

Definition at line 41 of file noalyss_user.class.php.

Referenced by connect_user(), getFirstName(), and setFirstName().

◆ $id

Noalyss_User::$id

in account_repository , ac_users.use_id

Definition at line 36 of file noalyss_user.class.php.

Referenced by getId(), load(), and setId().

◆ $lang

Noalyss_User::$lang

user's language

Definition at line 49 of file noalyss_user.class.php.

Referenced by connect_user().

◆ $last_name

Noalyss_User::$last_name

user's last_name

Definition at line 42 of file noalyss_user.class.php.

◆ $login

Noalyss_User::$login

login lower case

Definition at line 45 of file noalyss_user.class.php.

Referenced by connect_user(), getLogin(), and setLogin().

◆ $name

Noalyss_User::$name

Definition at line 43 of file noalyss_user.class.php.

Referenced by connect_user(), getName(), remove_inexistant_user(), and setName().

◆ $password

Noalyss_User::$password

md5 of the password

Definition at line 46 of file noalyss_user.class.php.

Referenced by Check(), getPassword(), and setPassword().

◆ $theme

Noalyss_User::$theme

user's CSS Theme

Definition at line 50 of file noalyss_user.class.php.

◆ $valid

Noalyss_User::$valid

is or is not valid

Definition at line 40 of file noalyss_user.class.php.

Referenced by getValid(), and setValid().


The documentation for this class was generated from the following file: