AbstractController.class.php 888 Bytes
<?php
/**
 * Created by PhpStorm.
 * User: zhoutao
 * Date: 16/8/9
 * Time: 上午10:44
 */
namespace Api\Controller\Integral;

use \Common\Controller\Api;
use Common\Model\PluginModel;
use Common\Service\AuthorityService;

abstract class AbstractController extends Api\AbstractController
{
    /**
     * 验证当前用户可见范围
     * 并且返回当前用户可以查看的应用以及岗位或角色IDs
     * @param $appKey
     * @return array
     */
    protected function checkAuthRange($appKey) {

        // 获取当前用户对应积分中心配置的可见范围
        $authorityService = new AuthorityService();
        $authorRange = $authorityService->userPermissionScope($this->_login->user, $appKey);
        if (empty($authorRange)) {
            E(L('_ERR_NO_PERMISSIONS_ERROR', ['name' => '积分排名']));
        }

        return $authorRange;
    }

}