本文整理汇总了PHP中Model_Users::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::getGroups方法的具体用法?PHP Model_Users::getGroups怎么用?PHP Model_Users::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::getGroups方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildAcl
/**
* buildAcl
* @param Model_Users $objModelUsers
* @return void
* @author Thomas Schedler <tsh@massiveart.com>
* @version 1.0
*/
public function buildAcl(Model_Users $objModelUsers)
{
try {
foreach (self::$arrZones as $arrZone) {
$this->arrZoneAcls['id_' . $arrZone['id']] = new Acl();
}
/**
* add groups
*/
$arrGroups = $objModelUsers->getGroups();
foreach ($arrGroups as $objGroup) {
foreach (self::$arrZones as $arrZone) {
if (!$this->arrZoneAcls['id_' . $arrZone['id']]->hasRole($objGroup->key)) {
$this->arrZoneAcls['id_' . $arrZone['id']]->addRole(new Zend_Acl_Role($objGroup->key));
}
}
}
/**
* add resources & groups & privileges
*/
$arrResources = $objModelUsers->getResourcesGroups();
foreach ($arrResources as $objResource) {
if (!$this->arrZoneAcls['id_' . self::ZONE_ZOOLU]->has($objResource->key)) {
$this->arrZoneAcls['id_' . self::ZONE_ZOOLU]->add(new Zend_Acl_Resource($objResource->key));
}
$this->arrZoneAcls['id_' . self::ZONE_ZOOLU]->allow($objResource->groupKey, $objResource->key, $objResource->permissionTitle);
}
} catch (Exception $exc) {
Zend_Registry::get('Core')->logger->err($exc);
}
}
示例2: callback_facebookAction
public function callback_facebookAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
$facebook = new WM_Facebook_Api(array('appId' => JO_Registry::forceGet('facebook_appid'), 'secret' => JO_Registry::forceGet('facebook_secret')));
$fbData = $facebook->api('/me');
if ($fbData['verified'] == 'true' && isset($fbData['id'])) {
$user = Model_Users::getFBuser($fbData['id']);
if ($user) {
$user['following'] = Model_Users::getFollowers($user['user_id']);
$groups = unserialize($user['groups']);
if (is_array($groups) and count($groups) > 1) {
unset($user['groups']);
$fetch_all = Model_Users::getGroups($groups);
$user['access'] = array();
if ($fetch_all) {
foreach ($fetch_all as $row) {
$modules = unserialize($row['rights']);
if (is_array($modules)) {
foreach ($modules as $module => $ison) {
$result['access'][$module] = $module;
}
}
}
}
}
if (isset($user['access']) && count($user['access'])) {
$user['is_admin'] = true;
}
JO_Session::set($user);
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=dashboard'));
} else {
$userData = array('fb_id' => $fbData['id'], 'firstname' => $fbData['first_name'], 'lastname' => $fbData['last_name'], 'email' => $fbData['email'], 'email_confirm' => $fbData['email'], 'username' => $fbData['username']);
JO_Session::set('fb_data', $userData);
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=registration'));
}
} else {
JO_Session::set('msg_error', $this->translate('Facebook login error. Please try again later.'));
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
}
}
示例3: indexAction
public function indexAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
if ($request->getQuery('openId') && strlen($request->getQuery('openId')) == 32 && $request->getServer('HTTP_REFERER')) {
$referer = str_replace('www.', '', JO_Validate::validateHost($request->getServer('HTTP_REFERER')));
$domain = $request->getDomain();
if ($referer && $referer != $domain && self::allowledReferal($referer)) {
//check user
if ($result = Model_Extensions_Singlesignon::checkUser($referer, $domain, $request->getQuery('openId'))) {
if ($result && $result['status'] == 'activate') {
$groups = unserialize($result['groups']);
if (is_array($groups) and count($groups) > 1) {
unset($result['groups']);
$fetch_all = Model_Users::getGroups($groups);
$result['access'] = array();
if ($fetch_all) {
foreach ($fetch_all as $row) {
$modules = unserialize($row['rights']);
if (is_array($modules)) {
foreach ($modules as $module => $ison) {
$result['access'][$module] = $module;
}
}
}
}
}
if (isset($result['access']) && count($result['access'])) {
$result['is_admin'] = true;
}
JO_Session::set($result);
}
} elseif (!JO_Session::get('user_id')) {
$url = 'http://' . $referer . '/public/extensions_singlesignon/getUserData/?openId=' . $request->getQuery('openId') . '&referer=' . $referer . '&domain=' . $domain;
if (ini_get('allow_url_fopen')) {
$response = file_get_contents($url);
} elseif (function_exists('curl_init')) {
$response = $this->file_get_contents_curl($url);
}
if ($response) {
$response = JO_Json::decode(JO_Encrypt_Md5::decrypt($response, $domain), true);
//register user
if ($response && is_array($response)) {
if ($result = Model_Extensions_Singlesignon::createUser($response)) {
$groups = self::mb_unserialize($result['groups']);
if (is_array($groups) and count($groups) > 1) {
unset($result['groups']);
$fetch_all = Model_Users::getGroups($groups);
$result['access'] = array();
if ($fetch_all) {
foreach ($fetch_all as $row) {
$modules = self::mb_unserialize($row['rights']);
if (is_array($modules)) {
foreach ($modules as $module => $ison) {
$result['access'][$module] = $module;
}
}
}
}
}
if (isset($result['access']) && count($result['access'])) {
$result['is_admin'] = true;
}
JO_Session::set($result);
}
}
}
}
}
$this->redirect($request->getBaseUrl());
}
$this->view->single_sign_on = array();
$single_sign_on = WM_Store::getSettingsPairs(array('filter_group' => 'single_sign_on'));
$model_images = new Model_Images();
$sort_order = array();
foreach ($single_sign_on as $row => $data) {
$sort_order[$row] = isset($data['sort_order']) ? $data['sort_order'] : 0;
if ($data['site_logo'] && file_exists(BASE_PATH . '/uploads/' . $data['site_logo'])) {
$data['preview'] = 'uploads/' . $data['site_logo'];
} else {
$data['preview'] = '';
}
$data['preview'] = $model_images->resize($data['site_logo'], 140, 30);
$data['href'] = 'http://' . $data['url'] . '/public/';
if (JO_Registry::get('singlesignon_enable_login') && JO_Session::get('user_id')) {
$data['href'] .= '?openId=' . md5($request->getDomain() . $data['url'] . JO_Session::get('username') . JO_Session::get('email'));
}
$this->view->single_sign_on[$row] = $data;
}
array_multisort($sort_order, SORT_ASC, $this->view->single_sign_on);
if (JO_Registry::get('singlesignon_enable_dropdown') && count($this->view->single_sign_on)) {
$this->view->ext_css = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=css&setFile=css.css');
$this->view->ext_js = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=js&setFile=js.js');
$this->getLayout()->placeholder('singlesignon', $this->view->render('index', 'extensions_singlesignon'));
}
}