isAdminUser() public static method

管理ユーザーかチェック
public static isAdminUser ( ) : boolean
return boolean
Esempio n. 1
0
 /**
  * 管理ユーザーかチェック
  * 
  * @param string $usergroup ユーザーグループ名
  * @param bool $expect 期待値
  * @dataProvider isAdminUserDataProvider
  */
 public function testIsAdminUser($usergroup, $expect)
 {
     $Session = new CakeSession();
     $sessionKey = Configure::read('BcAuthPrefix.admin.sessionKey');
     $Session->write('Auth.' . $sessionKey . '.UserGroup.name', $usergroup);
     $result = BcUtil::isAdminUser();
     $this->assertEquals($expect, $result, '正しく管理ユーザーがチェックできません');
 }
Esempio n. 2
0
 /**
  * Parses a string URL into an array. If a plugin key is found, it will be copied to the
  * controller parameter
  *
  * @param string $url The URL to parse
  * @return mixed false on failure, or an array of request parameters
  */
 public function parse($url)
 {
     if (is_array($url)) {
         return false;
     }
     if (BcUtil::isAdminSystem($url)) {
         return false;
     }
     $request = Router::getRequest(true);
     //管理システムにログインしているかつプレビューの場合は公開状態のステータスは無視する
     $publish = true;
     if (!empty($request->query['preview']) || !empty($request->query['force'])) {
         $publish = false;
     }
     $sameUrl = false;
     $site = BcSite::findCurrentSub(true);
     if ($site) {
         // 同一URL対応
         $sameUrl = true;
         $checkUrl = $site->makeUrl($request);
         @header('Vary: User-Agent');
     } else {
         $site = BcSite::findCurrent(true);
         if (!is_null($site->name)) {
             if ($site->useSubDomain) {
                 $checkUrl = '/' . $site->alias . ($url ? $url : '/');
             } else {
                 $checkUrl = $url ? $url : '/';
             }
         } else {
             if (!empty($request->query['force']) && BcUtil::isAdminUser()) {
                 // =================================================================================================
                 // 2016/11/10 ryuring
                 // 別ドメインの際に、固定ページのプレビューで、正しくサイト情報を取得できない。
                 // そのため、文字列でリクエストアクションを送信し、URLでホストを判定する。
                 // =================================================================================================
                 $tmpSite = BcSite::findByUrl($url);
                 if (!is_null($tmpSite)) {
                     $site = $tmpSite;
                 }
             }
             $checkUrl = $url ? $url : '/';
         }
     }
     $content = $this->getContent($checkUrl, $publish, false, $sameUrl, $site->useSubDomain);
     if (!$content) {
         $content = $this->getContent($checkUrl, $publish, true, $sameUrl, $site->useSubDomain);
     }
     if (!$content) {
         return false;
     }
     // データが存在してもプレビューで管理システムにログインしていない場合はログイン画面に遷移
     if ((!empty($request->query['preview']) || !empty($request->query['force'])) && !BcUtil::loginUser()) {
         $_SESSION['Auth']['redirect'] = $_SERVER['REQUEST_URI'];
         header('Location: ' . topLevelUrl(false) . baseUrl() . Configure::read('BcAuthPrefix.admin.alias') . '/users/login');
         exit;
     }
     $Content = ClassRegistry::init('Content');
     if ($content['Content']['alias_id'] && !$Content->isPublishById($content['Content']['alias_id'])) {
         return false;
     }
     $request->params['Content'] = $content['Content'];
     $request->params['Site'] = $content['Site'];
     $url = $site->getPureUrl($url);
     $params = $this->getParams($url, $content['Content']['url'], $content['Content']['plugin'], $content['Content']['type'], $content['Content']['entity_id'], $site->alias);
     if ($params) {
         return $params;
     }
     return false;
 }
<?php

/**
 * [Config] PetitBlogCustomField
 *
 * @link			http://www.materializing.net/
 * @author			arata
 * @package			PetitBlogCustomField
 * @license			MIT
 */
/**
 * システムナビ
 */
if (BcUtil::isAdminUser()) {
    $config['BcApp.adminNavi.petit_blog_custom_field'] = array('name' => 'プチ・ブログカスタムフィールドプラグイン', 'contents' => array(array('name' => 'ブログカスタムフィールド一覧', 'url' => array('admin' => true, 'plugin' => 'petit_blog_custom_field', 'controller' => 'petit_blog_custom_fields', 'action' => 'index')), array('name' => 'ブログカスタムフィールド設定一覧', 'url' => array('admin' => true, 'plugin' => 'petit_blog_custom_field', 'controller' => 'petit_blog_custom_field_configs', 'action' => 'index'))));
}
/**
 * フィールド名設定
 * 
 */
$config['petitBlogCustomField.field_name'] = array(1 => array('name' => 'テキスト', 'name_2' => 'テキスト2', 'textarea' => 'テキストエリア', 'radio' => 'ラジオ', 'select' => 'セレクト', 'date' => '日付', 'text_sub_1' => 'サブテキスト01', 'text_sub_2' => 'サブテキスト02', 'text_sub_3' => 'サブテキスト03', 'text_sub_4' => 'サブテキスト04', 'text_sub_5' => 'サブテキスト05', 'text_sub_6' => 'サブテキスト06', 'text_sub_7' => 'サブテキスト07', 'text_sub_8' => 'サブテキスト08', 'text_sub_9' => 'サブテキスト09', 'text_sub_10' => 'サブテキスト10'));
/**
 * プチ・カスタムフィールドデフォルト設定
 * 
 */
/**
 * ラジオ設定
 * 
 */
$config['petitBlogCustomField.status'] = array(1 => array(0 => 'この記事でカスタム項目を利用しない', 1 => 'この記事でカスタム項目を利用する'));
/**
Esempio n. 4
0
 /**
  * [PUBLIC] ブログアーカイブを表示する
  *
  * @param mixed	blog_post_id / type
  * @param mixed	blog_post_id / ""
  * @return void
  */
 public function archives()
 {
     // パラメーター処理
     $pass = $this->request->params['pass'];
     $type = $year = $month = $day = $id = '';
     $crumbs = $posts = array();
     $single = false;
     $posts = array();
     if ($pass[0] == 'category') {
         $type = 'category';
     } elseif ($pass[0] == 'author') {
         $type = 'author';
     } elseif ($pass[0] == 'tag') {
         $type = 'tag';
     } elseif ($pass[0] == 'date') {
         $type = 'date';
     }
     $crumbs[] = array('name' => $this->request->params['Content']['title'], 'url' => $this->request->params['Content']['url']);
     switch ($type) {
         /* カテゴリ一覧 */
         case 'category':
             $category = $pass[count($pass) - 1];
             if (empty($category)) {
                 //$this->notFound();
             }
             // ナビゲーションを設定
             $categoryId = $this->BlogCategory->field('id', array('BlogCategory.blog_content_id' => $this->contentId, 'BlogCategory.name' => urlencode($category)));
             if (!$categoryId) {
                 $this->notFound();
             }
             // 記事を取得
             $posts = $this->_getBlogPosts(array('conditions' => array('category' => urlencode($category))));
             $blogCategories = $this->BlogCategory->getPath($categoryId, array('name', 'title'));
             if (count($blogCategories) > 1) {
                 foreach ($blogCategories as $key => $blogCategory) {
                     if ($key < count($blogCategories) - 1) {
                         $crumbs[] = array('name' => $blogCategory['BlogCategory']['title'], 'url' => $this->request->params['Content']['url'] . '/archives/category/' . $blogCategory['BlogCategory']['name']);
                     }
                 }
             }
             $this->pageTitle = $blogCategories[count($blogCategories) - 1]['BlogCategory']['title'];
             $template = $this->blogContent['BlogContent']['template'] . DS . 'archives';
             $this->set('blogArchiveType', $type);
             break;
         case 'author':
             $author = h($pass[count($pass) - 1]);
             $posts = $this->_getBlogPosts(array('conditions' => array('author' => $author)));
             $data = $this->BlogPost->User->find('first', array('fields' => array('real_name_1', 'real_name_2', 'nickname'), 'conditions' => array('User.name' => $author)));
             App::uses('BcBaserHelper', 'View/Helper');
             $BcBaser = new BcBaserHelper(new View());
             $userName = $BcBaser->getUserName($data);
             $this->pageTitle = urldecode($userName);
             $template = $this->blogContent['BlogContent']['template'] . DS . 'archives';
             $this->set('blogArchiveType', $type);
             break;
             /* タグ別記事一覧 */
         /* タグ別記事一覧 */
         case 'tag':
             $tag = h($pass[count($pass) - 1]);
             if (empty($this->blogContent['BlogContent']['tag_use']) || empty($tag)) {
                 $this->notFound();
             }
             $posts = $this->_getBlogPosts(array('conditions' => array('tag' => $tag)));
             $this->pageTitle = urldecode($tag);
             $template = $this->blogContent['BlogContent']['template'] . DS . 'archives';
             $this->set('blogArchiveType', $type);
             break;
             /* 月別アーカイブ一覧 */
         /* 月別アーカイブ一覧 */
         case 'date':
             $year = h($pass[1]);
             $month = h(@$pass[2]);
             $day = h(@$pass[3]);
             if (!$year && !$month && !$day) {
                 $this->notFound();
             }
             $posts = $this->_getBlogPosts(array('conditions' => array('year' => $year, 'month' => $month, 'day' => $day)));
             $this->pageTitle = $year . '年';
             if ($month) {
                 $this->pageTitle .= $month . '月';
             }
             if ($day) {
                 $this->pageTitle .= $day . '日';
             }
             $template = $this->blogContent['BlogContent']['template'] . DS . 'archives';
             if ($day) {
                 $this->set('blogArchiveType', 'daily');
             } elseif ($month) {
                 $this->set('blogArchiveType', 'monthly');
             } else {
                 $this->set('blogArchiveType', 'yearly');
             }
             break;
             /* 単ページ */
         /* 単ページ */
         default:
             // プレビュー
             if ($this->BcContents->preview && !empty($this->request->data['BlogPost'])) {
                 $post = $this->BlogPost->createPreviewData($this->request->data);
             } else {
                 if (!empty($pass[0])) {
                     $id = $pass[0];
                 } else {
                     $this->notFound();
                 }
                 // コメント送信
                 if (isset($this->request->data['BlogComment'])) {
                     $this->add_comment($id);
                 }
                 $post = $this->_getBlogPosts(array('preview' => (bool) $this->BcContents->preview, 'conditions' => array('id' => $id)));
                 if (!empty($post[0])) {
                     $post = $post[0];
                 } else {
                     $this->notFound();
                 }
                 // 一覧系のページの場合、時限公開の記事が存在し、キャッシュがあると反映できないが、
                 // 詳細ページの場合は、記事の終了期間の段階でキャッシュが切れる前提となる為、キャッシュを利用する
                 // プレビューでは利用しない事。
                 // コメント送信時、キャッシュはクリアされるが、モバイルの場合、このメソッドに対してデータを送信する為、
                 // キャッシュがあるとデータが処理されないので、キャッシュは全く作らない設定とする
                 if (BcSite::findCurrent()->device != 'mobile') {
                     $this->BcContents->useViewCache = true;
                 }
             }
             if (BcUtil::isAdminUser()) {
                 $this->set('editLink', array('admin' => true, 'plugin' => 'blog', 'controller' => 'blog_posts', 'action' => 'edit', $post['BlogPost']['blog_content_id'], $post['BlogPost']['id']));
             }
             // ナビゲーションを設定
             if (!empty($post['BlogPost']['blog_category_id'])) {
                 $blogCategories = $this->BlogCategory->getPath($post['BlogPost']['blog_category_id'], array('name', 'title'));
                 if ($blogCategories) {
                     foreach ($blogCategories as $blogCategory) {
                         $crumbs[] = array('name' => $blogCategory['BlogCategory']['title'], 'url' => $this->request->params['Content']['url'] . '/archives/category/' . $blogCategory['BlogCategory']['name']);
                     }
                 }
             }
             $this->pageTitle = $post['BlogPost']['name'];
             $single = true;
             $template = $this->blogContent['BlogContent']['template'] . DS . 'single';
             if ($this->BcContents->preview) {
                 $this->blogContent['BlogContent']['comment_use'] = false;
             }
             $this->set('post', $post);
     }
     // 表示設定
     $this->crumbs = array_merge($this->crumbs, $crumbs);
     $this->set('single', $single);
     $this->set('posts', $posts);
     $this->set('year', $year);
     $this->set('month', $month);
     $this->render($template);
 }
Esempio n. 5
0
 /**
  * beforeFilter
  *
  * @return	void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $isRequestView = $this->request->is('requestview');
     $isUpdate = $this->request->is('update');
     $isAdmin = $this->request->is('admin');
     $isInstall = $this->request->is('install');
     $isMaintenance = $this->request->is('maintenance');
     // 設定されたサイトURLとリクエストされたサイトURLが違う場合は設定されたサイトにリダイレクト
     if ($isAdmin) {
         if ($this->request->is('ssl')) {
             $siteUrl = Configure::read('BcEnv.sslUrl');
         } else {
             $siteUrl = Configure::read('BcEnv.siteUrl');
         }
         if ($siteUrl && siteUrl() != $siteUrl) {
             $this->redirect($siteUrl . preg_replace('/^\\//', '', Router::reverse($this->request, false)));
         }
     }
     // メンテナンス
     if (!empty($this->siteConfigs['maintenance']) && Configure::read('debug') < 1 && !$isMaintenance && !$isAdmin && !BcUtil::isAdminUser()) {
         if (!empty($this->request->params['return']) && !empty($this->request->params['requested'])) {
             return;
         } else {
             $redirectUrl = '/maintenance';
             if ($this->request->params['Site']['alias']) {
                 $redirectUrl = '/' . $this->request->params['Site']['alias'] . $redirectUrl;
             }
             $this->redirect($redirectUrl);
         }
     }
     // セキュリティ設定
     $this->Security->blackHoleCallback = '_blackHoleCallback';
     if (!BC_INSTALLED || $isUpdate) {
         $this->Security->validatePost = false;
     }
     if ($isAdmin) {
         $this->Security->validatePost = false;
         $corePlugins = Configure::read('BcApp.corePlugins');
         if (BC_INSTALLED && (!$this->plugin || in_array($this->plugin, $corePlugins)) && Configure::read('debug') === 0) {
             $this->Security->csrfCheck = true;
         } else {
             $this->Security->csrfCheck = false;
         }
         // SSLリダイレクト設定
         if (Configure::read('BcApp.adminSsl')) {
             $adminSslMethods = array_filter(get_class_methods(get_class($this)), array($this, '_adminSslMethods'));
             if ($adminSslMethods) {
                 $this->Security->requireSecure = $adminSslMethods;
             }
         }
     }
     //$this->Security->validatePost = false;
     // 送信データの文字コードを内部エンコーディングに変換
     $this->__convertEncodingHttpInput();
     // $this->request->query['url'] の調整
     // 環境によって?キーにamp;が付加されてしまうため
     if (isset($this->request->query) && is_array($this->request->query)) {
         foreach ($this->request->query as $key => $val) {
             if (strpos($key, 'amp;') === 0) {
                 $this->request->query[substr($key, 4)] = $val;
                 unset($this->request->query[$key]);
             }
         }
     }
     // コンソールから利用される場合、$isInstall だけでは判定できないので、BC_INSTALLED も判定に入れる
     if (!BC_INSTALLED || $isInstall || $isUpdate) {
         return;
     }
     // Ajax ヘッダー
     if ($this->request->is('ajax')) {
         // キャッシュ対策
         header("Cache-Control: no-cache, must-revalidate");
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Pragma: no-cache");
     }
     // テーマ内プラグインのテンプレートをテーマに梱包できるようにプラグインパスにテーマのパスを追加
     // ===============================================================================
     // 実際には、プラグインの場合も下記パスがテンプレートの検索対象となっている為不要だが、
     // ビューが存在しない場合に、プラグインテンプレートの正規のパスがエラーメッセージに
     // 表示されてしまうので明示的に指定している。
     // (例)
     // [変更後] app/webroot/theme/demo/blog/news/index.php
     // [正 規] app/plugins/blog/views/theme/demo/blog/news/index.php
     // 但し、CakePHPの仕様としてはテーマ内にプラグインのテンプレートを梱包できる仕様となっていないので
     // 将来的には、blog / mail / feed をプラグインではなくコアへのパッケージングを検討する必要あり。
     // ※ AppView::_pathsも関連している
     // ===============================================================================
     $pluginThemePath = WWW_ROOT . 'theme' . DS . $this->theme . DS;
     $pluginPaths = Configure::read('pluginPaths');
     if ($pluginPaths && !in_array($pluginThemePath, $pluginPaths)) {
         Configure::write('pluginPaths', am(array($pluginThemePath), $pluginPaths));
     }
     // 認証設定
     if (isset($this->BcAuthConfigure)) {
         $authConfig = array();
         if (!empty($this->request->params['prefix'])) {
             $currentAuthPrefix = $this->request->params['prefix'];
         } else {
             $currentAuthPrefix = 'front';
         }
         $authPrefixSettings = Configure::read('BcAuthPrefix');
         foreach ($authPrefixSettings as $key => $authPrefixSetting) {
             if (isset($authPrefixSetting['alias']) && $authPrefixSetting['alias'] == $currentAuthPrefix) {
                 $authConfig = $authPrefixSetting;
                 $authConfig['auth_prefix'] = $authPrefixSetting['alias'];
                 break;
             }
             if ($key == $currentAuthPrefix) {
                 $authConfig = $authPrefixSetting;
                 $authConfig['auth_prefix'] = $key;
                 break;
             }
         }
         if ($authConfig) {
             $this->BcAuthConfigure->setting($authConfig);
         } else {
             $this->BcAuth->setSessionKey('Auth.' . Configure::read('BcAuthPrefix.admin.sessionKey'));
         }
         // =================================================================
         // ユーザーの存在チェック
         // ログイン中のユーザーを管理側で削除した場合、ログイン状態を削除する必要がある為
         // =================================================================
         $user = $this->BcAuth->user();
         if ($user && $authConfig) {
             $userModel = $authConfig['userModel'];
             $User = ClassRegistry::init($userModel);
             if (strpos($userModel, '.') !== false) {
                 list($plugin, $userModel) = explode('.', $userModel);
             }
             if ($userModel && !empty($this->{$userModel})) {
                 $conditions = array($userModel . '.id' => $user['id'], $userModel . '.name' => $user['name']);
                 if (isset($User->belongsTo['UserGroup'])) {
                     $UserGroup = ClassRegistry::init('UserGroup');
                     $userGroups = $UserGroup->find('all', array('conditions' => array('UserGroup.auth_prefix LIKE' => '%' . $authConfig['auth_prefix'] . '%'), 'recursive' => -1));
                     $userGroupIds = Hash::extract($userGroups, '{n}.UserGroup.id');
                     $conditions[$userModel . '.user_group_id'] = $userGroupIds;
                 }
                 if (!$User->find('count', array('conditions' => $conditions, 'recursive' => -1))) {
                     $this->Session->delete(BcAuthComponent::$sessionKey);
                 }
             }
         }
     }
     if ($isRequestView) {
         // テーマ、レイアウトとビュー用サブディレクトリの設定
         $this->setTheme();
         if (isset($this->request->params['prefix'])) {
             $this->layoutPath = str_replace('_', '/', $this->request->params['prefix']);
             $this->subDir = str_replace('_', '/', $this->request->params['prefix']);
         }
         if (!$isAdmin && !empty($this->request->params['Site']['name'])) {
             $agentSetting = Configure::read('BcAgent.' . $this->request->params['Site']['device']);
             if ($agentSetting && !empty($agentSetting['helper'])) {
                 $this->helpers[] = $agentSetting['helper'];
             }
             if (isset($this->request->params['Site'])) {
                 $this->layoutPath = $this->request->params['Site']['name'];
                 $this->subDir = $this->request->params['Site']['name'];
             }
         }
         // 権限チェック
         if (isset($User->belongsTo['UserGroup']) && isset($this->BcAuth) && isset($this->request->params['prefix']) && empty($this->request->params['Site']['name']) && isset($this->request->params['action']) && empty($this->request->params['requested'])) {
             if (!$this->BcAuth->allowedActions || !in_array($this->request->params['action'], $this->BcAuth->allowedActions)) {
                 $user = $this->BcAuth->user();
                 $Permission = ClassRegistry::init('Permission');
                 if ($user) {
                     if (!$Permission->check($this->request->url, $user['user_group_id'])) {
                         $this->setMessage('指定されたページへのアクセスは許可されていません。', true);
                         $this->redirect($this->BcAuth->loginRedirect);
                     }
                 }
             }
         }
     }
 }
Esempio n. 6
0
 /**
  * 管理者グループかどうかチェックする
  *
  * @param int $userGroupId ユーザーグループID(初期値 : null)※ 指定しない場合は、現在のログインユーザーについてチェックする
  * @return bool 管理者グループの場合は true を返す
  */
 public function isAdminUser($userGroupId = null)
 {
     if (!$userGroupId) {
         return BcUtil::isAdminUser();
     }
     if ($userGroupId == Configure::read('BcApp.adminGroupId')) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
    $entityId = $Content->field('entity_id', ['Content.url' => $checkUrl]);
    $urlArray[$key] = $this->BcBaser->getLink(urldecode($value), ['admin' => true, 'plugin' => '', 'controller' => 'content_folders', 'action' => 'edit', $entityId], ['forceTitle' => true]);
}
$baseUrl = '';
if ($urlArray) {
    $baseUrl = implode('/', $urlArray) . '/';
}
$baseUrl = $host . $baseUrl;
$pureUrl = $this->BcContents->getPureUrl($this->request->data['Content']['url'], $this->request->data['Site']['id']);
$this->BcBaser->js('admin/contents/edit', false, array('id' => 'AdminContentsEditScript', 'data-fullurl' => $this->BcContents->getUrl($this->request->data['Content']['url'], true, $this->request->data['Site']['use_subdomain']), 'data-current' => json_encode($this->request->data), 'data-settings' => $this->BcContents->getJsonSettings()));
$currentSiteId = $siteId = $this->request->data['Site']['id'];
if (is_null($currentSiteId)) {
    $currentSiteId = 0;
}
$disableEdit = false;
if (!BcUtil::isAdminUser() || $this->request->data['Site']['relate_main_site'] && $this->request->data['Content']['main_site_content_id'] && ($this->request->data['Content']['alias_id'] || $this->request->data['Content']['type'] == 'ContentFolder')) {
    $disableEdit = true;
}
$isOmitViewAction = $this->BcContents->settings[$this->request->data['Content']['type']]['omitViewAction'];
?>


<?php 
echo $this->BcForm->hidden('Content.id');
echo $this->BcForm->hidden('Content.plugin');
echo $this->BcForm->hidden('Content.type');
echo $this->BcForm->hidden('Content.entity_id');
echo $this->BcForm->hidden('Content.parent_id');
echo $this->BcForm->hidden('Content.url');
echo $this->BcForm->hidden('Content.alias_id');
echo $this->BcForm->hidden('Content.site_root');
 /**
  * [ADMIN] ファイル一覧を表示
  *
  * ファイルアップロード時にリダイレクトされた場合、
  * RequestHandlerコンポーネントが作動しないので明示的に
  * レイアウト、デバッグフラグの設定をする
  *
  * @param	int		$id		呼び出し元 識別ID
  * @param	string	$filter
  * @return	void
  * @access	public
  */
 public function admin_ajax_list($id = '')
 {
     Configure::write('debug', 0);
     $default = array('named' => array('num' => $this->siteConfigs['admin_list_num']));
     $this->setViewConditions('UploadFile', array('default' => $default, 'type' => 'get'));
     $this->request->data['Filter'] = $this->passedArgs;
     if (empty($this->request->data['Filter']['uploader_type'])) {
         $this->request->data['Filter']['uploader_type'] = 'all';
     }
     if (!empty($this->request->data['Filter']['name'])) {
         $this->request->data['Filter']['name'] = urldecode($this->request->data['Filter']['name']);
     }
     // =====================================================================
     // setViewConditions で type を get に指定した場合、
     // 自動的に $this->passedArgs['num'] 設定されないので明示的に取得
     // TODO setViewConditions の仕様を見直す
     // =====================================================================
     if ($this->params['named']['num']) {
         $this->Session->write('UploaderFilesAdminAjaxList.named.num', $this->params['named']['num']);
     }
     if ($this->Session->read('UploaderFilesAdminAjaxList.named.num')) {
         $num = $this->Session->read('UploaderFilesAdminAjaxList.named.num');
     } else {
         $num = $this->siteConfigs['admin_list_num'];
     }
     $conditions = $this->_createAdminIndexConditions($this->request->data['Filter']);
     // 管理ユーザ以外が利用時、ユーザ制限がOnになっていれば一覧に表示しない
     $uploaderConfig = $this->UploaderConfig->findExpanded();
     if (isset($uploaderConfig['use_permission']) && $uploaderConfig['use_permission'] && !BcUtil::isAdminUser()) {
         $user = BcUtil::loginUser();
         if ($user) {
             $conditions['UploaderFile.user_id'] = $user['id'];
         }
     }
     $this->paginate = array('conditions' => $conditions, 'fields' => array(), 'order' => 'created DESC', 'limit' => $num);
     $dbDatas = $this->paginate('UploaderFile');
     foreach ($dbDatas as $key => $dbData) {
         $limited = !empty($dbData['UploaderFile']['publish_begin']) || !empty($dbData['UploaderFile']['publish_end']);
         $files = $this->UploaderFile->filesExists($dbData['UploaderFile']['name'], $limited);
         $dbData = Set::merge($dbData, array('UploaderFile' => $files));
         $dbDatas[$key] = $dbData;
     }
     $this->set('installMessage', $this->checkInstall());
     $uploaderConfig = $this->UploaderConfig->findExpanded();
     $this->set('listId', $id);
     $this->set('files', $dbDatas);
     if (empty($uploaderConfig['layout_type'])) {
         $layoutType = 'panel';
     } else {
         $layoutType = 'table';
     }
     $this->set('layoutType', $uploaderConfig['layout_type']);
 }
Esempio n. 9
0
/**
 * baserCMS :  Based Website Development Project <http://basercms.net>
 * Copyright (c) baserCMS Users Community <http://basercms.net/community/>
 *
 * @copyright		Copyright (c) baserCMS Users Community
 * @link			http://basercms.net baserCMS Project
 * @package			Baser.View
 * @since			baserCMS v 4.0.0
 * @license			http://basercms.net/license/index.html
 */
/**
 * [ADMIN] 統合コンテンツ一覧
 */
$currentUser = BcUtil::loginUser('admin');
$this->BcBaser->js('admin/vendors/jquery.jstree-3.3.1/jstree.min', false);
$this->BcBaser->js('admin/contents/index', false, ['id' => 'AdminContentsIndexScript', 'data-isAdmin' => BcUtil::isAdminUser(), 'data-isUseMoveContents' => (bool) $currentUser['UserGroup']['use_move_contents'], 'data-adminPrefix' => Configure::read('BcAuthPrefix.admin.alias')]);
$this->BcBaser->js('admin/libs/jquery.bcTree', false);
$this->BcBaser->js(array('admin/libs/jquery.baser_ajax_data_list', 'admin/libs/jquery.baser_ajax_batch', 'admin/libs/baser_ajax_data_list_config', 'admin/libs/baser_ajax_batch_config'));
echo $this->BcForm->input('BcManageContent', array('type' => 'hidden', 'value' => $this->BcContents->getJsonSettings()));
?>


<script type="text/javascript">

</script>

<div id="AlertMessage" class="message" style="display:none"></div>
<div id="MessageBox" style="display:none"><div id="flashMessage" class="notice-message"></div></div>

<?php 
$this->BcBaser->element('contents/index_view_setting');