本文整理汇总了PHP中permissions类的典型用法代码示例。如果您正苦于以下问题:PHP permissions类的具体用法?PHP permissions怎么用?PHP permissions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了permissions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: listAll
public function listAll()
{
$toReturn = array();
$toReturn['grades'] = gradeLevels::get()->toArray();
$toReturn['userRole'] = $this->data['users']->role;
$toReturn['newuserRole'] = $this->data['users']->newrole;
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 3)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
return $toReturn;
}
开发者ID:schoex,项目名称:Campusmate,代码行数:26,代码来源:GradeLevelsController.php
示例2: listAll
public function listAll()
{
$toReturn['exams'] = examsList::where('examAcYear', $this->panelInit->selectAcYear)->get()->toArray();
if ($this->data['users']->role == "teacher") {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->where('classTeacher', 'LIKE', '%"' . $this->data['users']->id . '"%')->get()->toArray();
} else {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
}
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 1)->where('permission', 1)->get();
$uniparam = array(5, 6, 7, 8, 15);
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
$toReturn['newuserRole'] = $this->data['users']->newrole;
return $toReturn;
}
开发者ID:schoex,项目名称:Campusmate,代码行数:27,代码来源:ExamsListController.php
示例3: smarty_function_get_nodes_by_parent
function smarty_function_get_nodes_by_parent($params, &$smarty)
{
global $node;
$sql_time = "";
$sql_type = "";
$parent = $params['parent'];
$permissions = permissions::checkPerms($parent);
if (!$permissions['r']) {
$error = $error_messages['READ_PERMISSION_ERROR'];
return false;
}
$parent_vectot = $parent['node_vector'];
if ($params['listing_amount'] == 'all') {
$listing_amount = DEF_MAX_LISTING_AMMOUNT;
} else {
$listing_amount = $params['listing_amount'];
}
if (empty($params['offset'])) {
$offset = 0;
} else {
$offset = $params['offset'];
}
if (isset($params['orderby'])) {
$orderby = db_escape_string($params['orderby']);
}
global $db, $node;
$node_id = $node['node_id'];
$user_id = $_SESSION['user_id'];
if (isset($params['time'])) {
$sql_time = " nodes.node_created > '" . db_escape_string($params['time']) . "' and ";
}
$q = "select parent.node_name as parent_name,users.*,nodes.*,node_access.node_user_subchild_count from nodes left join nodes as parent on parent.node_id=nodes.node_parent left join node_access on node_access.node_id=nodes.node_id and node_access.user_id='{$user_id}' left join users on users.user_id=nodes.node_creator where ";
$q .= " {$sql_time} nodes.node_parent='{$parent}' and nodes.node_system_access!='private'";
if (isset($_POST['template_event']) && $_POST['template_event'] == 'filter_by') {
if (isset($_POST['search_type']) && $_POST['search_type'] == 'content') {
$sql_type .= " and node_content like '%" . db_escape_string($_POST['node_content']) . "%' ";
} else {
$q2 = "select user_id from users where login='" . db_escape_string($_POST['node_content']) . "'";
$userset = $db->query($q2);
$userset->next();
$id = $userset->getString('user_id');
$sql_type = " and nodes.node_creator='{$id}'";
}
$q .= $sql_type;
}
if (isset($orderby)) {
$q .= " order by {$orderby} ";
} else {
$q .= " order by nodes.node_id desc ";
}
$q .= " LIMIT {$offset},{$listing_amount} ";
$set = $db->query($q);
while ($set->next()) {
$pole[] = $set->getRecord();
}
$smarty->assign('get_nodes_by_parent', $pole);
}
开发者ID:Kyberia,项目名称:Kyberia-bloodline,代码行数:57,代码来源:function.get_nodes_by_parent.php
示例4: update
public function update()
{
$moduleId = Input::get('moduleId');
$roleId = Input::get('roleId');
$permissionValue = Input::get('permission');
$matchThese = ['moduleId' => $moduleId, 'roleId' => $roleId];
$permissions = permissions::where('roleId', '=', $roleId)->first();
$query = 'update permissions set permission= ' . $permissionValue . ' where moduleId =' . $moduleId . ' and roleId=' . $roleId;
$result = DB::update($query);
return 1;
}
开发者ID:schoex,项目名称:Campusmate,代码行数:11,代码来源:PermissionsController.php
示例5: getUserWarns
/**
* Возвращает список предупреждение пользователя для попап окна.
*
* @param int $uid UID пользователя
* @param array $contextId Контекст (для лога админских действий)
* @param string $draw_func способ отображения
*
* @return object xajaxResponse
*/
function getUserWarns($uid = 0, $contextId = '', $draw_func = '')
{
session_start();
$objResponse = new xajaxResponse();
if (hasPermissions('users')) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/permissions.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$user = new users();
$user->GetUserByUID($uid);
if ($user->uid) {
$aPermissions = permissions::getUserPermissions($_SESSION['uid']);
$admin_log = new admin_log('user', $_SESSION['uid'], $aPermissions);
$aWarns = $admin_log->getUserWarns($nCount, $uid);
$sCount = $nCount ? $nCount : '0';
$sWarns = $user->warn ? $user->warn : '0';
$objResponse->assign('a_user_warns', 'href', '/users/' . $user->login);
$objResponse->assign('s_user_warns', 'innerHTML', $user->uname . ' ' . $user->usurname . ' [' . $user->login . ']');
$objResponse->assign('e_user_warns', 'innerHTML', $sWarns);
$objResponse->assign('n_user_warns', 'innerHTML', $sCount);
if ($nCount) {
$sTable = '<table id="t_user_warns" class="notice-table">';
$nCount = 1;
foreach ($aWarns as $aOne) {
$sReason = $aOne['admin_comment'] ? hyphen_words($aOne['admin_comment'], true) : '<без причины>';
$sAdmin = $aOne['adm_login'] ? '<a target="_blank" href="/users/' . $aOne['adm_login'] . '">' . $aOne['adm_login'] . '</a>' : 'не известно';
$sDate = $aOne['act_time'] ? date('d.m.Y H:i', strtotime($aOne['act_time'])) : 'не известно';
$sTable .= '<tr>
<td class="cell-number">' . $nCount . '.</td>
<td class="cell-uwarn">' . $sReason . '</td>
<td class="cell-who">Выдан: [' . $sAdmin . ']
<td class="cell-date">' . $sDate . '</td>
<td' . ($aOne['src_id'] ? ' id="i_user_warns_' . $aOne['src_id'] . '"' : '') . '>' . ($aOne['src_id'] ? '<a href="javascript:void(0);" onclick="banned.warnUser(' . $uid . ',' . $aOne['src_id'] . ',\'' . $draw_func . '\',\'' . $contextId . '\',0);"><img src="/images/btn-remove2.png" alt="" width="11" height="11" /></a>' : '') . '</td>
</tr>';
++$nCount;
}
$sTable .= '</table>';
$objResponse->assign('d_user_warns', 'innerHTML', $sTable);
} else {
$objResponse->assign('d_user_warns', 'innerHTML', ' ');
}
$sBanTitle = $user->is_banned || $user->ban_where ? 'Разбанить' : 'Забанить';
$objResponse->script('adminLogOverlayClose();');
$objResponse->script("\$('ov-notice4').setStyle('display', '');");
$objResponse->script('adjustUserWarnsHTML();');
$objResponse->assign('b_user_warns', 'innerHTML', '<button onclick="adminLogOverlayClose();banned.userBan(' . $uid . ', \'' . $contextId . '\',0)">' . $sBanTitle . '</button><a class="lnk-dot-grey" href="javascript:void(0);" onclick="adminLogOverlayClose();">Отмена</a>');
}
}
return $objResponse;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:58,代码来源:admin_log.server.php
示例6: __construct
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
$this->data['breadcrumb']['User Settings'] = \URL::to('/dashboard/user');
$this->data['users'] = \Auth::user();
$params = permissions::where('moduleId', 2)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
$params = permissions::where('moduleId', 4)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam2[] = $param->roleId;
}
$this->data['attendancepermission'] = $uniparam;
$this->data['staffattendancepermission'] = $uniparam2;
}
开发者ID:schoex,项目名称:Campusmate,代码行数:17,代码来源:DashboardController.php
示例7: checkUserDat
function checkUserDat()
{
global $returnedDBdata;
if (!empty($_GET['Char']) && !empty($_GET['Server'])) {
// First run check for currently searched character
$charTOfetch = $_GET['Char'];
$fromWHATserver = $_GET['Server'];
// Lookup character in local DB
$resp = roster_db::lookup($charTOfetch, $fromWHATserver);
$returnedDBdata = $resp->lookupData;
// If <is || not> in local DB
if ($resp->count == 1) {
viewChar($charTOfetch, $fromWHATserver);
} else {
permissions::verify($functWanted = 'fetchCharDat', $functElse = 'recentlySyncd', $rankWanted = '0');
}
} else {
// Else if no get data to use
nochar();
}
}
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:21,代码来源:wowchar.php
示例8: get_mysql_server_version
get_mysql_server_version();
$lang = get_config('language_set');
require_once 'i18n/' . $lang . '/i18n.php';
require_once PATH_TO_CLASSES . '/cls_fast_template.php';
require_once PATH_TO_CLASSES . '/cls_permissions.php';
// inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony
$ft = new FastTemplate('./templates/' . $lang . '/tpl');
// egzemplarz klasy obs³uguj±cej bazê danych Core
$db = new DB_SQL();
// pobieramy poziom uprawnieñ
$query = sprintf("\r\n SELECT \r\n permission_level \r\n FROM \r\n %1\$s \r\n WHERE \r\n login = '%2\$s'", TABLE_USERS, $_SESSION['login']);
$db->query($query);
$db->next_record();
$privileges = $db->f('permission_level');
// egzemplarz klasy do obs³ugi uprawnieñ
$perms = new permissions();
$permarr = $perms->getPermissions($privileges);
$ft->assign(array('PERMS_USER' => false, 'PERMS_WRITER' => false, 'PERMS_MODERATOR' => false, 'PERMS_TPLEDITOR' => false, 'PERMS_ADMIN' => false));
switch ($privileges) {
case '1':
$privilege_level = 1;
$ft->assign('PERMS_USER', true);
break;
case '3':
$privilege_level = 2;
$ft->assign('PERMS_USER', true);
$ft->assign('PERMS_WRITER', true);
break;
case '7':
$privilege_level = 3;
$ft->assign('PERMS_USER', true);
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:31,代码来源:main.php
示例9: dialplan
//.........这里部分代码省略.........
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=\$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=" . $this->queue_cid_prefix . "#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name . '@' . $_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":", $this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0]) + 1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where call_center_queue_uuid = '" . $this->call_center_queue_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
开发者ID:bitplus,项目名称:fusionpbx,代码行数:101,代码来源:call_center.php
示例10: foreach
">
<input type="submit" value=" Показать ">
</form>
<br><br>
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<?php
if ($users) {
?>
<?php
foreach ($users as $user) {
?>
<?php
$user_groups = permissions::getUserGroups($user['uid']);
$user_rights = permissions::getUserExtraRights($user['uid']);
$utype = is_emp($user['role']) ? 'emp' : 'frl';
?>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr valign="top" class="n_qpr">
<td width="70" align="center"><a name="user_<?php
echo $user['uid'];
?>
"></a><a href="/users/<?php
echo $user['login'];
?>
" class="<?php
echo $utype;
?>
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:31,代码来源:inner_user_list.php
示例11: AddForum
/**
* Adds a forum with parameters from $this->post
*
* @author Mark Elliot <[email protected]>
* @since Beta 2.1
* @return string Completion message
**/
function AddForum()
{
if (trim($this->post['name']) == '') {
return "The forum name is empty. (Please press back and enter a name)";
}
$forums = $this->forum_grab();
$forums_arr = $this->forum_array($forums, $this->post['parent']);
$position = $forums_arr ? count($forums_arr) : 0;
$this->db->query("INSERT INTO {$this->pre}forums\r\n\t\t(forum_tree, forum_parent, forum_name, forum_description, forum_position) VALUES\r\n\t\t('" . $this->CreateTree($forums, $this->post['parent']) . "', '{$this->post['parent']}', '{$this->post['name']}', '{$this->post['description']}', '{$position}')");
$id = $this->db->insert_id();
$perms = new permissions();
$perms->db =& $this->db;
$perms->pre =& $this->pre;
while ($perms->get_group()) {
// Full permissions (note: the banned group is still false)
if ($this->post['sync'] == -2) {
$perms->add_z($id, $perms->group != USER_BANNED);
// Default permissions (only works if there are no forums already created)
} elseif ($this->post['sync'] == -3) {
$perms->add_z($id);
// No permissions
} elseif ($this->post['sync'] == -1) {
$perms->add_z($id, false);
// Copy another forum
} else {
$perms->add_z($id, false);
foreach ($perms->standard as $perm => $false) {
if (!isset($perms->globals[$perm])) {
$perms->set_xyz($perm, $id, $perms->auth($perm, $this->post['sync']));
}
}
}
$perms->update();
}
return "Forum added!<br/><br/><a href='{$this->self}'>Continue</a>";
}
开发者ID:BackupTheBerlios,项目名称:mercuryb-svn,代码行数:43,代码来源:forums.php
示例12: permissions
$p_level = 1;
break;
case '3':
$p_level = 2;
break;
case '7':
$p_level = 3;
break;
case '15':
$p_level = 4;
break;
case '31':
$p_level = 5;
break;
}
$new_permissions = new permissions();
if ($plevel == "down") {
if ($p_level == 1) {
$ft->assign('CONFIRM', $i18n['edit_users'][8]);
} else {
$p_level = $p_level - 1;
switch ($p_level) {
case '3':
$new_permissions->permissions["user"] = TRUE;
$new_permissions->permissions["writer"] = TRUE;
$new_permissions->permissions["moderator"] = TRUE;
break;
case '2':
$new_permissions->permissions["user"] = TRUE;
$new_permissions->permissions["writer"] = TRUE;
break;
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:31,代码来源:edit_users.php
示例13: listar
function listar($tpl)
{
if (isset($_POST['submit_corps_search'])) {
//Se toma el n�mero de registros y se guarda en varable de sesi�n
//que se cumpla en todos los accesos del usuario
$_SESSION['num_regs'] = $_POST['regs'];
}
$num = $this->get_list_emps($_SESSION['ident_corp']);
$tabla_listado = new table(true);
$per = new permissions();
$per->get_permissions_list('emps');
if ($num == 0) {
$cadena = '' . $cadena . $tabla_listado->tabla_vacia('emps', $per->add);
$variables = $tabla_listado->nombres_variables;
} else {
$cadena = '' . $tabla_listado->make_tables('emps', $this->emps_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array($this->ddbb_id_emp, $this->ddbb_name, $this->ddbb_last_name, $this->ddbb_last_name2), $_SESSION['num_regs'], $per->permissions_module, $per->add);
$variables = $tabla_listado->nombres_variables;
}
$tpl->assign('variables', $variables);
$tpl->assign('cadena', $cadena);
return $tpl;
}
开发者ID:BackupTheBerlios,项目名称:facturaphp-svn,代码行数:22,代码来源:emps.class.php
示例14: updateUser
/**
* Изменить информацию о группах и правах пользователя
*
* @param integer $uid ID пользователя
* @param array $groups Информация о группах
* @param array $rights_allow Информация о разрешенных правах
*/
function updateUser($uid, $groups, $rights_allow)
{
global $DB;
$user_groups_rights = array();
if (!is_array($rights_allow)) {
$rights_allow = array();
}
if (!is_array($rights_disallow)) {
$rights_disallow = array();
}
$sql = "DELETE FROM permissions_groups_users WHERE user_id=?i";
$DB->query($sql, $uid);
$sql = "DELETE FROM permissions_rights_users WHERE user_id=?i";
$DB->query($sql, $uid);
if (is_array($groups)) {
$sql = "";
if ($groups) {
foreach ($groups as $group) {
$g_rights = permissions::getGroupInfo($group);
if ($g_rights['rights']) {
foreach ($g_rights['rights'] as $g_right) {
if (!in_array($g_right, $user_groups_rights)) {
array_push($user_groups_rights, $g_right);
}
}
}
$sql .= "INSERT INTO permissions_groups_users(group_id,user_id) VALUES({$group},{$uid});\n ";
}
$DB->query($sql);
$DB->query("UPDATE users SET is_chuck = true WHERE uid = {$uid}");
}
}
$tr_allow = array_diff($rights_allow, $user_groups_rights);
$tr_disallow = array_diff($user_groups_rights, $rights_allow);
$rights_allow = $tr_allow;
$rights_disallow = $tr_disallow;
if (is_array($rights_allow)) {
$sql = "";
if ($rights_allow) {
foreach ($rights_allow as $right) {
$sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'t');\n ";
}
$DB->query($sql);
}
}
if (is_array($rights_disallow)) {
$sql = "";
if ($rights_disallow) {
foreach ($rights_disallow as $right) {
$sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'f');\n ";
}
$DB->query($sql);
}
}
}
开发者ID:amage,项目名称:fl-ru-damp,代码行数:62,代码来源:permissions.php
示例15: view
function view($id, $tpl)
{
/*
Cosas que faltan por hacer:
De forma general, mirar los permisos del usuario que vaya a acceder aqui, para saber si tiene permisos de borrar editar ver etc...
Averiguar como pasar el numero de registros, si va a ser a grupos a grupos, si va a ser a modulos, a modulos
Order By (y mantener la b�squeda en el caso de que hubiera hecha una y averiguar la "pesta�a" a la que hace referencia)
Busquedas
*/
$cadena = '';
// Leemos la empresa y se lo pasamos a la plantilla
$this->read($id);
$tpl->assign('objeto', $this);
$_SESSION['id_client'] = $this->id_client;
//listado de contactos
$tabla_contactos = new table(false);
$contactos = new contacts();
if ($contactos->get_list_contacts($_SESSION['id_client']) == 0) {
$per = new permissions();
$per->get_permissions_list('clients');
$cadena = $cadena . $tabla_contactos->tabla_vacia('contacts', $per->add);
$variables_empleados = $tabla_contactos->nombres_variables;
} else {
$per = new permissions();
$per->get_permissions_list('clients');
$cadena = $cadena . $tabla_contactos->make_tables('contacts', $contactos->contacts_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array('id_contact', 'name', 'last_name', 'last_name2'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
$variables_contactos = $tabla_contactos->nombres_variables;
}
$facturaspen = new table(false);
$facturascob = new table(false);
$albaranes = new table(false);
$partes = new table(false);
$cadena = $cadena . $facturaspen->dont_show('facturaspen');
$cadena = $cadena . $facturascob->dont_show('facturascob');
$cadena = $cadena . $albaranes->dont_show('albaranes');
$cadena = $cadena . $partes->dont_show('partes');
$variables_facturaspen = $facturaspen->nombres_variables;
$variables_facturascob = $facturascobs->nombres_variables;
$variables_albaranes = $albaranes->nombres_variables;
$variables_partes = $partes->nombres_variables;
$i = 0;
while ($i < count($variables_contactos) + count($variables_facturaspen) + count($variables_facturascob) + count($variables_products) + count($variables_services) + count($variables_albaranes) + count($variables_partes)) {
for ($j = 0; $j < count($variables_contactos); $j++) {
$variables[$i] = $variables_contactos[$j];
$i++;
}
for ($j = 0; $j < count($variables_facturaspen); $j++) {
$variables[$i] = $variables_facturaspen[$j];
$i++;
}
for ($j = 0; $j < count($variables_facturascob); $j++) {
$variables[$i] = $variables_facturascob[$j];
$i++;
}
for ($j = 0; $j < count($variables_albaranes); $j++) {
$variables[$i] = $variables_albaranes[$j];
$i++;
}
for ($j = 0; $j < count($variables_partes); $j++) {
$variables[$i] = $variables_partes[$j];
$i++;
}
}
//Se comprueba si hay permiso para borrar o modificar
$permisos_mod_del = new permissions();
$permisos_mod_del->get_permissions_modify_delete('clients');
$tpl->assign('acciones', $permisos_mod_del->per_mod_del);
$tpl->assign('variables', $variables);
$tpl->assign('cadena', $cadena);
//
return $tpl;
}
开发者ID:BackupTheBerlios,项目名称:facturaphp-svn,代码行数:72,代码来源:clients.class.php
示例16: hasGroupPermissions
/**
* Проверяем входит ли пользователь в группу прав доступа
*
* @param string код группы(administrator - администраторы, moderator - модераторы)
* @param integer ID пользователя
* @return boolean true - входит, false - не входит
*/
function hasGroupPermissions($group, $uid = 0)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/permissions.php";
if (!$uid) {
$uid = get_uid(false);
}
return permissions::getUserGroupPermissions($uid, $group);
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:15,代码来源:stdf.php
示例17: update_subscriptions
/**
* Checks Subscriptions to make sure subscribed members can
* still view the forum where the topic has been moved too
*
* @param $newtopic integer of the selected topic
* @author Jonathan West <[email protected]>
* @since 1.1.6
**/
function update_subscriptions($newtopic)
{
$query = $this->db->query("SELECT s.subscription_user, s.subscription_item, s.subscription_type,\r\n\t\t\t\t\t\t\t\t\tu.user_id, u.user_group, u.user_perms,\r\n\t\t\t\t\t\t\t\t\tg.group_id, g.group_perms,\r\n\t\t\t\t\t\t\t\t\tt.topic_forum\r\n\t\t\t\t\t\t\t\t\tFROM ({$this->pre}subscriptions s, {$this->pre}users u, {$this->pre}groups g, {$this->pre}topics t)\r\n\t\t\t\t\t\t\t\t\tWHERE s.subscription_user = u.user_id\r\n\t\t\t\t\t\t\t\t\tAND u.user_group = g.group_id\r\n\t\t\t\t\t\t\t\t\tAND t.topic_id = {$this->get['t']}\r\n\t\t\t\t\t\t\t\t\t");
while ($sub = $this->db->nqfetch($query)) {
$perms = new permissions();
$perms->db =& $this->db;
$perms->pre =& $this->pre;
$perms->get_perms($sub['user_group'], $sub['user_id'], $sub['user_perms'] ? $sub['user_perms'] : $sub['group_perms']);
if (!$perms->auth('forum_view', $sub['topic_forum'])) {
$this->db->query("DELETE FROM {$this->pre}subscriptions WHERE subscription_user={$sub['user_id']} AND subscription_item={$sub['subscription_item']}");
} else {
$this->db->query('UPDATE ' . $this->pre . 'subscriptions SET subscription_item=' . $newtopic . ' WHERE subscription_item=' . $this->get['t'] . " AND subscription_type='topic'");
}
if (!$perms->auth('forum_subscribe', $sub['topic_forum'])) {
$this->db->query("DELETE FROM {$this->pre}subscriptions WHERE subscription_user={$sub['user_id']} AND subscription_item={$sub['subscription_item']}");
}
}
}
开发者ID:BackupTheBerlios,项目名称:mercuryb-svn,代码行数:26,代码来源:mod.php
示例18: Auth
//.........这里部分代码省略.........
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/opauth/OpauthModel.php';
$opauthModel = new OpauthModel();
$is_2fa = $opauthModel->getMultilevel($res['uid']);
if (isset($is_2fa['type'])) {
//$is_2fa - авторизация через выбранную соцсеть
//0 - нужна обычная авторизация так как вход был выполнен через соцсеть
$params['2fa_provider'] = array('type' => !$is_opauth ? $is_2fa['type'] : 0, 'uid' => $res['uid'], 'login' => $res['login']);
//Сбрасываем авторизацию
$res = array();
//переходим ко 2ой стадии
return self::AUTH_STATUS_2FA;
}
}
}
//Более нам параметр этапов авторизации не нужен
unset($params['2fa_provider']);
/**
* Успешная авторизация.
*/
if (count($res)) {
list($email, $trole, $tname, $tsurname, $tid, $is_banned, $ban_where, $active, $sum, $bonus_sum, $log, $anti_uid, $is_pro_test, $is_pro_new, $is_chuck, $sex, $settings, $splash_show, $is_verify, $reg_date, $activate_code, $photo, $is_profi, $birthday) = array_values($res);
if ($activate_code != '' && $active == 't') {
$this->checkRegDate($tid, $reg_date);
}
if ($is_banned) {
return -1;
}
//if ($active=='f') return -2; //##0027983
if (!$this->CheckUserAllowIP($ip, $tid)) {
return -3;
}
$params['birthday'] = $birthday ? strtotime($birthday) : null;
$params['age'] = $params['birthday'] ? intval(ElapsedYears($params['birthday'])) : null;
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/permissions.php';
$params['permissions'] = permissions::getUserPermissions($tid);
$params['email'] = $email;
$params['role'] = $trole;
$params['name'] = $tname;
$params['surname'] = $tsurname;
$params['uid'] = $tid;
$params['user_ip'] = $ip;
$params['ac_sum'] = zin($sum);
$params['bn_sum'] = zin($bonus_sum);
$params['login'] = $log;
$params['is_pro_new'] = $is_pro_new;
$params['pro_test'] = $is_pro_test;
$params['is_chuck'] = $is_chuck;
$params['is_verify'] = $is_verify;
$params['sex'] = $sex;
$params['reg_date'] = $reg_date;
$params['photo'] = $photo;
if (!is_emp($trole)) {
$params['is_profi'] = $is_profi === 't';
}
if ($anti_uid) {
$anti_class = is_emp($trole) ? 'freelancer' : 'employer';
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/{$anti_class}.php";
$anti = new $anti_class();
$anti->GetUserByUID($anti_uid);
$params['anti_uid'] = $anti->uid;
$params['anti_login'] = $anti->login;
$params['anti_surname'] = $anti->usurname;
$params['anti_name'] = $anti->uname;
}
if (!is_emp($params['role'])) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_offers.php';
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:67,代码来源:users.php
示例19: array
}
}
}
$user_rights_data = permissions::getUserExtraRights($user_id);
$user_rights_allow = array();
$user_rights_disallow = array();
foreach ($user_rights_data as $user_right) {
if ($user_right['is_allow'] == 't') {
array_push($user_rights_allow, $user_right['id']);
} else {
array_push($user_rights_disallow, $user_right['id']);
}
}
$inner_page = 'inner_user_form.php';
break;
case 'user_update':
$user_id = __paramInit('int', 'uid
|
请发表评论