(privileges)
return retVal
Inspects privileges to see if those are comming from an admin user
Inspects privileges to see if those are comming from an admin user
Inspects privileges to see if those are comming from an admin user
def isAdminFromPrivileges(privileges):
    """
    Inspects privileges to see if those are comming from an admin user
    """

    # In PostgreSQL the usesuper privilege means that the
    # user is DBA
    retVal = (Backend.isDbms(DBMS.PGSQL) and "super" in privileges)

    # In Oracle the DBA privilege means that the
    # user is DBA
    retVal |= (Backend.isDbms(DBMS.ORACLE) and "DBA" in privileges)

    # In MySQL >= 5.0 the SUPER privilege means
    # that the user is DBA
    retVal |= (Backend.isDbms(DBMS.MYSQL) and kb.data.has_information_schema and "SUPER" in privileges)

    # In MySQL < 5.0 the super_priv privilege means
    # that the user is DBA
    retVal |= (Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema and "super_priv" in privileges)

    # In Firebird there is no specific privilege that means
    # that the user is DBA
    # TODO: confirm
    retVal |= (Backend.isDbms(DBMS.FIREBIRD) and all(_ in privileges for _ in ("SELECT", "INSERT", "UPDATE", "DELETE", "REFERENCES", "EXECUTE")))

    return retVal
def isAdminFromPrivileges ( privileges ) : # In PostgreSQL the usesuper privilege means that the # user is DBA retVal = ( Backend . isDbms ( DBMS . PGSQL ) and "super" in privileges ) # In Oracle the DBA privilege means that the # user is DBA retVal |= ( Backend . isDbms ( DBMS . ORACLE ) and "DBA" in privileges ) # In MySQL >= 5.0 the SUPER privilege means # that the user is DBA retVal |= ( Backend . isDbms ( DBMS . MYSQL ) and kb . data . has_information_schema and "SUPER" in privileges ) # In MySQL < 5.0 the super_priv privilege means # that the user is DBA retVal |= ( Backend . isDbms ( DBMS . MYSQL ) and not kb . data . has_information_schema and "super_priv" in privileges ) # In Firebird there is no specific privilege that means # that the user is DBA # TODO: confirm retVal |= ( Backend . isDbms ( DBMS . FIREBIRD ) and all ( _ in privileges for _ in ( "SELECT" , "INSERT" , "UPDATE" , "DELETE" , "REFERENCES" , "EXECUTE" ) ) ) return retVal