当前位置: 首页>>代码示例>>PHP>>正文


PHP Auth::getCurrentRole方法代码示例

本文整理汇总了PHP中Auth::getCurrentRole方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::getCurrentRole方法的具体用法?PHP Auth::getCurrentRole怎么用?PHP Auth::getCurrentRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Auth的用法示例。


在下文中一共展示了Auth::getCurrentRole方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIssueIDs

 public function getIssueIDs($options)
 {
     // Build the Sphinx client
     $this->sphinx->SetSortMode(SPH_SORT_RELEVANCE);
     //        $this->sphinx->SetWeights(array(1, 1));
     $this->sphinx->SetLimits(0, 500, 100000);
     $this->sphinx->SetArrayResult(true);
     if (empty($options['match_mode'])) {
         $options['match_mode'] = SPH_MATCH_ALL;
     }
     $this->sphinx->SetMatchMode($options['match_mode']);
     $this->sphinx->SetFilter('prj_id', array(Auth::getCurrentProject()));
     // TODO: Add support for selecting indexes to search
     $indexes = implode('; ', $this->getIndexes(Auth::getCurrentRole() > User::ROLE_CUSTOMER));
     if (isset($options['customer_id']) && !empty($options['customer_id'])) {
         $this->sphinx->SetFilter('customer_id', array($options['customer_id']));
     }
     $this->keywords = $options['keywords'];
     $this->match_mode = $options['match_mode'];
     $res = $this->sphinx->Query($options['keywords'], $indexes);
     // TODO: report these somehow back to the UI
     // probably easy to do with Logger framework (add new handler?)
     if (method_exists($this->sphinx, 'IsConnectError') && $this->sphinx->IsConnectError()) {
         Logger::app()->error('sphinx_fulltext_search: Network Error');
     }
     if ($this->sphinx->GetLastWarning()) {
         Logger::app()->warning('sphinx_fulltext_search: ' . $this->sphinx->GetLastWarning());
     }
     if ($this->sphinx->GetLastError()) {
         Logger::app()->error('sphinx_fulltext_search: ' . $this->sphinx->GetLastError());
     }
     $issue_ids = array();
     if (isset($res['matches'])) {
         foreach ($res['matches'] as $match_details) {
             // Variable translation
             $match_id = $match_details['id'];
             $issue_id = $match_details['attrs']['issue_id'];
             $weight = $match_details['weight'];
             $index_id = $match_details['attrs']['index_id'];
             // if sphinx returns 0 as a weight, make it one because it
             // did find a match in the result set
             if ($weight <= 0) {
                 $weight = 1;
             }
             $index_name = $this->getIndexNameByID($index_id);
             $this->matches[$issue_id][] = array('weight' => $weight, 'index' => $index_name, 'match_id' => $match_id);
             $issue_ids[] = $issue_id;
         }
     }
     return $issue_ids;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:51,代码来源:class.sphinx_fulltext_search.php

示例2: getListing

 /**
  * Method used to get the list of changes made against a specific issue.
  *
  * @param   integer $iss_id The issue ID
  * @param   string $order_by The order to sort the history
  * @return  array The list of changes
  */
 public static function getListing($iss_id, $order_by = 'DESC')
 {
     $order_by = DB_Helper::orderBy($order_by);
     $stmt = "SELECT\n                    *\n                 FROM\n                    {{%issue_history}},\n                    {{%history_type}}\n                 WHERE\n                    htt_id = his_htt_id AND\n                    his_is_hidden != 1 AND\n                    his_iss_id=? AND\n                    his_min_role <= ?\n                 ORDER BY\n                    his_id {$order_by}";
     $params = array($iss_id, Auth::getCurrentRole());
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, $params);
     } catch (DbException $e) {
         return '';
     }
     foreach ($res as &$row) {
         $row['his_summary'] = Misc::processTokens(ev_gettext($row['his_summary']), $row['his_context']);
     }
     return $res;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:22,代码来源:class.history.php

示例3: getColumnsToDisplay

 /**
  * Returns the columns that should be displayed for the specified page.
  * This method will remove columns that should not be displayed, due to
  * lack of customer integration or insufficient role.
  *
  * @param   integer $prj_id The ID of the project.
  * @param   string $page The page to return columns for.
  * @return  array An array of columns that should be displayed.
  */
 public static function getColumnsToDisplay($prj_id, $page)
 {
     static $returns;
     // poor man's caching system
     if (!empty($returns[$prj_id][$page])) {
         return $returns[$prj_id][$page];
     }
     $current_role = Auth::getCurrentRole();
     $data = self::getSelectedColumns($prj_id, $page);
     $has_customer_integration = CRM::hasCustomerIntegration($prj_id);
     $only_with_customers = array('iss_customer_id', 'support_level');
     // remove groups if there are no groups in the system.
     if (count(Group::getAssocList($prj_id)) < 1) {
         unset($data['iss_grp_id']);
     }
     // remove category column if there are no categories in the system
     if (count(Category::getAssocList($prj_id)) < 1) {
         unset($data['prc_title']);
     }
     // remove custom fields column if there are no custom fields
     if (count(Custom_Field::getFieldsToBeListed($prj_id)) < 1) {
         unset($data['custom_fields']);
     }
     // remove customer field if user has a role of customer
     if ($current_role == User::getRoleID('Customer')) {
         unset($data['iss_customer_id']);
     }
     foreach ($data as $field => $info) {
         // remove fields based on role
         if ($info['min_role'] > $current_role) {
             unset($data[$field]);
             continue;
         }
         // remove fields based on customer integration
         if (!$has_customer_integration && in_array($field, $only_with_customers)) {
             unset($data[$field]);
             continue;
         }
         // get title
         $data[$field] = self::getColumnInfo($page, $field);
         if (!isset($data[$field]['width'])) {
             $data[$field]['width'] = '';
         }
     }
     $returns[$prj_id][$page] = $data;
     return $data;
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:56,代码来源:class.display_column.php

示例4: dirname

// | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
// | GNU General Public License for more details.                         |
// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 51 Franklin Street, Suite 330                                          |
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: Bryan Alsdorf <balsdorf@gmail.com>                          |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('select_partners.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$_POST['issue_id'] ? $_POST['issue_id'] : $_GET['iss_id'];
if (!Access::canViewDrafts($issue_id, Auth::getUserID()) || Auth::getCurrentRole() <= User::getRoleID('Standard User')) {
    $tpl = new Template_Helper();
    $tpl->setTemplate('permission_denied.tpl.html');
    $tpl->displayTemplate();
    exit;
}
$prj_id = Issue::getProjectID($issue_id);
if (@$_POST['cat'] == 'update') {
    $res = Partner::selectPartnersForIssue($_POST['issue_id'], @$_POST['partners']);
    $tpl->assign('update_result', $res);
}
$tpl->assign(array('issue_id' => $issue_id, 'enabled_partners' => Partner::getPartnersByProject($prj_id), 'partners' => Partner::getPartnersByIssue($issue_id), 'current_user_prefs' => Prefs::get(Auth::getUserID())));
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:partners.php

示例5: remove

 /**
  * Method used to remove specific custom filters.
  *
  * @return  integer 1 if the removals worked properly, any other value otherwise
  */
 public static function remove()
 {
     foreach ($_POST['item'] as $cst_id) {
         $stmt = 'DELETE FROM
                     {{%custom_filter}}
                  WHERE';
         $params = array();
         if (self::isGlobal($cst_id)) {
             if (Auth::getCurrentRole() >= User::ROLE_MANAGER) {
                 $stmt .= ' cst_is_global=1 AND ';
             } else {
                 $stmt .= '
                     cst_is_global=1 AND
                     cst_usr_id=? AND ';
                 $params[] = Auth::getUserID();
             }
         } else {
             $stmt .= ' cst_usr_id=? AND ';
             $params[] = Auth::getUserID();
         }
         $stmt .= '
                     cst_prj_id=? AND
                     cst_id=?';
         $params[] = Auth::getCurrentProject();
         $params[] = $cst_id;
         try {
             DB_Helper::getInstance()->query($stmt, $params);
         } catch (DbException $e) {
             return -1;
         }
     }
     return 1;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:38,代码来源:class.filter.php

示例6: getListing

 /**
  * Method used to get the full listing of notes associated with
  * a specific issue.
  *
  * @param   integer $issue_id The issue ID
  * @return  array The list of notes
  */
 public static function getListing($issue_id)
 {
     $stmt = 'SELECT
                 not_id,
                 not_created_date,
                 not_title,
                 not_usr_id,
                 not_unknown_user,
                 not_has_attachment,
                 not_is_blocked AS has_blocked_message,
                 usr_full_name
              FROM
                 {{%note}},
                 {{%user}}
              WHERE
                 not_usr_id=usr_id AND
                 not_iss_id=? AND
                 not_removed = 0
              ORDER BY
                 not_created_date ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id));
     } catch (DbException $e) {
         return '';
     }
     // only show the internal notes for users with the appropriate permission level
     $role_id = Auth::getCurrentRole();
     $user_role_id = User::ROLE_USER;
     $t = array();
     foreach ($res as &$row) {
         if ($role_id < $user_role_id) {
             continue;
         }
         // Display not_unknown_user instead of usr_full_name if not null.
         // This is so the original sender of a blocked email is displayed on the note.
         if (!empty($row['not_unknown_user'])) {
             $row['usr_full_name'] = $row['not_unknown_user'];
         }
         $t[] = $row;
         unset($row);
     }
     return $t;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:50,代码来源:class.note.php

示例7: getMailQueue

/**
 * Selects a mail queue entry from the table and returns the contents.
 * 
 * @param   string $id The mail queue entry ID.
 * @return  A string containing the body.
 */
function getMailQueue($id)
{
    if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
        return;
    }
    $res = Mail_Queue::getEntry($id);
    if (!empty($_GET["ec_id"])) {
        return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id . ":" . $res["maq_headers"] . "\n" . $res["maq_body"])));
    } else {
        return $res["maq_body"];
    }
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:18,代码来源:get_remote_data.php

示例8: remove

 /**
  * Method used to remove specific custom filters.
  *
  * @access  public
  * @return  integer 1 if the removals worked properly, any other value otherwise
  */
 function remove()
 {
     global $HTTP_POST_VARS;
     $items = implode(", ", Misc::escapeInteger($HTTP_POST_VARS["item"]));
     foreach ($HTTP_POST_VARS["item"] as $cst_id) {
         $stmt = "DELETE FROM\n                        " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_filter\n                     WHERE";
         if (Filter::isGlobal($cst_id)) {
             if (Auth::getCurrentRole() >= User::getRoleID('Manager')) {
                 $stmt .= " cst_is_global=1 AND ";
             } else {
                 $stmt .= " \n                        cst_is_global=1 AND\n                        cst_usr_id=" . Auth::getUserID() . " AND ";
             }
         } else {
             $stmt .= " cst_usr_id=" . Auth::getUserID() . " AND ";
         }
         $stmt .= "\n                        cst_prj_id=" . Auth::getCurrentProject() . " AND\n                        cst_id={$cst_id}";
         $res = $GLOBALS["db_api"]->dbh->query($stmt);
         if (PEAR::isError($res)) {
             Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
             return -1;
         }
     }
     return 1;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:30,代码来源:class.filter.php

示例9: catch

            if (CRM::hasCustomerIntegration($prj_id)) {
                $sender_email = Mail_Helper::getEmailAddress($email_details['sup_from']);
                try {
                    $contact = $crm->getContactByEmail($sender_email);
                    $tpl->assign('contact_details', $contact->getDetails());
                } catch (CRMException $e) {
                }
            }
        }
    }
}
$tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getAssocList($prj_id), 'severities' => Severity::getList($prj_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'releases' => Release::getAssocList($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, 'report_form'), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true), 'field_display_settings' => Project::getFieldDisplaySettings($prj_id), 'groups' => Group::getAssocList($prj_id), 'products' => Product::getList(false)));
$prefs = Prefs::get($usr_id);
$tpl->assign('user_prefs', $prefs);
$tpl->assign('zones', Date_Helper::getTimezoneList());
if (Auth::getCurrentRole() == User::getRoleID('Customer')) {
    $crm = CRM::getInstance(Auth::getCurrentProject());
    $customer_contact_id = User::getCustomerContactID($usr_id);
    $contact = $crm->getContact($customer_contact_id);
    $customer_id = Auth::getCurrentCustomerID();
    $customer = $crm->getCustomer($customer_id);
    // TODOCRM: Pull contacts via ajax when user selects contract
    $tpl->assign(array('customer_id' => $customer_id, 'contact_id' => $customer_contact_id, 'customer' => $customer, 'contact' => $contact));
}
$clone_iss_id = isset($_GET['clone_iss_id']) ? (int) $_GET['clone_iss_id'] : null;
if ($clone_iss_id && Access::canCloneIssue($clone_iss_id, $usr_id)) {
    $tpl->assign(Issue::getCloneIssueTemplateVariables($clone_iss_id));
} else {
    $tpl->assign('defaults', $_REQUEST);
}
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:new.php

示例10: formatValue

 function formatValue($value, $fld_id, $issue_id, $functional = false)
 {
     if (!trim($value)) {
         return '';
     }
     $admin_folder = '';
     $roll_id = Auth::getCurrentRole();
     if ($roll_id >= User::getRoleID('manager')) {
         $admin_folder = 'admin/';
     }
     $href = "../" . $admin_folder . "viewTransaction.php?ref={$value}&hide_header=1&nolink=1";
     if ($roll_id <= User::getRoleID('reporter')) {
         return $value;
     }
     if (!$functional) {
         return "<a href='{$href}' target='_top' >{$value}</a>";
     }
     $text = "<a href='javascript:td_showtrans(\"{$href}\");' >{$value}</a> <input type='button' value='Route to Merchant' class='button' onClick='javascript:mercAssign({$issue_id});'>&nbsp;<BR>";
     return $text;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:20,代码来源:class.transaction.php

示例11: getMailQueue

/**
 * Selects a mail queue entry from the table and returns the contents.
 *
 * @param   string $id The mail queue entry ID.
 * @return  A string containing the body.
 */
function getMailQueue($id)
{
    if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
        return;
    }
    $res = Mail_Queue::getEntry($id);
    if (!Issue::canAccess($res['maq_iss_id'], $GLOBALS['usr_id'])) {
        return '';
    }
    if (empty($_GET['ec_id'])) {
        return $res['maq_body'];
    }
    return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($res['maq_headers'] . "\n" . $res['maq_body'])));
}
开发者ID:korusdipl,项目名称:eventum,代码行数:20,代码来源:get_remote_data.php

示例12:

    $_COOKIE[APP_HIDE_CLOSED_STATS_COOKIE] = $_REQUEST['hide_closed'];
}
if (isset($_COOKIE[APP_HIDE_CLOSED_STATS_COOKIE])) {
    $hide_closed = $_COOKIE[APP_HIDE_CLOSED_STATS_COOKIE];
} else {
    $hide_closed = 0;
}
$tpl->assign('hide_closed', $hide_closed);
if ($role_id == User::getRoleID('customer')) {
    $crm = CRM::getInstance($prj_id);
    // need the activity dashboard here
    $contact_id = User::getCustomerContactID($usr_id);
    $customer_id = Auth::getCurrentCustomerID();
    $tpl->assign(array('contact' => $crm->getContact($contact_id), 'customer' => $crm->getCustomer($customer_id)));
} else {
    if (Auth::getCurrentRole() <= User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
        $tpl->assign('hide_stats', true);
    } else {
        $tpl->assign('hide_stats', false);
        $tpl->assign('status', Stats::getStatus());
        $tpl->assign('releases', Stats::getRelease($hide_closed));
        $tpl->assign('categories', Stats::getCategory($hide_closed));
        $tpl->assign('priorities', Stats::getPriority($hide_closed));
        $tpl->assign('users', Stats::getUser($hide_closed));
        $tpl->assign('emails', Stats::getEmailStatus($hide_closed));
        $tpl->assign('pie_chart', Stats::getPieChart($hide_closed));
    }
}
if (@$_REQUEST['hide_closed'] == '') {
    $Stats_Search_Profile = Search_Profile::getProfile($usr_id, $prj_id, 'stats');
    if (!empty($Stats_Search_Profile)) {
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:main.php

示例13: date

$tpl->setTemplate("reports/stalled_issues.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
if (Auth::getCurrentRole() <= User::getRoleID("Customer")) {
    echo "Invalid role";
    exit;
}
$prj_id = Auth::getCurrentProject();
if (count(@$_REQUEST['before']) < 1) {
    $before = date("Y-m-d", time() - MONTH);
} else {
    $before = join('-', $_REQUEST['before']);
}
if (count(@$_REQUEST['after']) < 1) {
    $after = date("Y-m-d", time() - YEAR);
} else {
    $after = join('-', $_REQUEST['after']);
}
if (empty($_REQUEST['sort_order'])) {
    $_REQUEST['sort_order'] = 'ASC';
}
$data = Report::getStalledIssuesByUser($prj_id, @$_REQUEST['developers'], @$_REQUEST['status'], $before, $after, $_REQUEST['sort_order']);
$groups = Group::getAssocList($prj_id);
$assign_options = array();
if (count($groups) > 0 && Auth::getCurrentRole() > User::getRoleID("Customer")) {
    foreach ($groups as $grp_id => $grp_name) {
        $assign_options["grp:{$grp_id}"] = "Group: " . $grp_name;
    }
}
$assign_options += Project::getUserAssocList($prj_id, 'active', User::getRoleID('Standard User'));
$tpl->assign(array("users" => $assign_options, "before_date" => $before, "after_date" => $after, "data" => $data, "developers" => @$_REQUEST['developers'], "status_list" => Status::getAssocStatusList($prj_id), "status" => @$_REQUEST['status'], "sort_order" => $_REQUEST['sort_order']));
$tpl->displayTemplate();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:stalled_issues.php

示例14: getFieldsToBeListed

 /**
  * Method to return the names of the fields which should be displayed on the list issues page.
  *
  * @access  public
  * @param   integer $prj_id The ID of the project.
  * @return  array An array of custom field names.
  */
 function getFieldsToBeListed($prj_id)
 {
     $sql = "SELECT\n                    fld_id,\n                    fld_title\n                FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_field,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_custom_field\n                WHERE\n                    fld_id = pcf_fld_id AND\n                    pcf_prj_id = " . Misc::escapeInteger($prj_id) . " AND\n                    fld_list_display = 1  AND\n                    fld_min_role <= " . Auth::getCurrentRole() . "\n                ORDER BY\n                    fld_rank ASC";
     $res = $GLOBALS["db_api"]->dbh->getAssoc($sql);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return array();
     } else {
         return $res;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:18,代码来源:class.custom_field.php

示例15: getListing

 /**
  * Method used to get the list of changes made against a specific issue.
  *
  * @access  public
  * @param   integer $iss_id The issue ID
  * @param   string $order_by The order to sort the history
  * @return  array The list of changes
  */
 function getListing($iss_id, $order_by = 'DESC')
 {
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_history,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "history_type\n                 WHERE\n                    htt_id = his_htt_id AND\n                    his_is_hidden != 1 AND\n                    his_iss_id=" . Misc::escapeInteger($iss_id) . " AND\n                    htt_role <= " . Auth::getCurrentRole() . "\n                 ORDER BY\n                    his_id {$order_by}";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["his_created_date"] = Date_API::getFormattedDate($res[$i]["his_created_date"]);
             $res[$i]["his_summary"] = Mime_Helper::fixEncoding($res[$i]["his_summary"]);
         }
         return $res;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:23,代码来源:class.history.php


注:本文中的Auth::getCurrentRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。