What is the function of getAuthSQL()

Discussion in 'Developers' Forum' started by laptop_user, Oct 10, 2015.

  1. laptop_user

    laptop_user Member

    Hi everyone. What is the function of getAuthSQL(r) or getAuthSQL(u)? I sometimes see it in during SELECT query. I believe it's a function?? What file in the ISPC directory can I open to see what it does?

    Thanks in advance.
     
    Last edited: Oct 11, 2015
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This function creates a sql snippet to validate the access rights of the queried database records. Take a look at the database library to see the code of this function.
     
    laptop_user likes this.
  3. laptop_user

    laptop_user Member

    Yes, thank you. I found it but still, what is the purpose of (r), (u), (a) and ('r', 'b')? What are the code referring too? My guess is (r) is referring to 'Read' but what are others for?

    I appreciate your reply. Thank you.


    PHP:
        function getAuthSQL($perm$table '') {
            global 
    $app;
         
            
    $perm $app->db->quote($perm);
            
    $table $app->db->quote($table);
         
            if(
    $_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0) {
                return 
    '1';
            } else {
                if (
    $table != ''){
                    
    $table ' ' $table '.';
                }
                
    $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
                
    $sql '(';
                
    $sql .= "(" $table "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " $table "sys_perm_user like '%$perm%') OR  ";
                
    $sql .= "(" $table "sys_groupid IN (".$groups.") AND " $table ."sys_perm_group like '%$perm%') OR ";
                
    $sql .= $table "sys_perm_other like '%$perm%'";
                
    $sql .= ')';

                return 
    $sql;
            }
        }
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    r = read, u = update, i = insert, d = delete. There is no "b" or "a" permission.
     

Share This Page