|
@@ -105,6 +105,22 @@ class Auth
|
|
|
return $this->real($this->data(), $state);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前登录的管理员信息
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function authData($state = true)
|
|
|
+ {
|
|
|
+ $data = $this->info($state);
|
|
|
+
|
|
|
+ if (isset($data['role_info']['auth_data'])) {
|
|
|
+ return $data['role_info']['auth_data'];
|
|
|
+ }
|
|
|
+
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 实时读取信息
|
|
|
*
|
|
@@ -294,6 +310,7 @@ class Auth
|
|
|
if ($user['id'] == 1) {
|
|
|
$user['oper'] = 'all';
|
|
|
$user['auth'] = 'all';
|
|
|
+ $user['auth_data'] = 'all';
|
|
|
$user['top'] = 'all';
|
|
|
} else {
|
|
|
$role = Dever::db('manage/role')->get(array('where_id' => $user['role']));
|
|
@@ -301,6 +318,7 @@ class Auth
|
|
|
if ($role) {
|
|
|
$user['oper'] = array();
|
|
|
$user['auth'] = array();
|
|
|
+ $user['auth_data'] = array();
|
|
|
$user['self'] = 2;
|
|
|
$top = array();
|
|
|
foreach ($role as $k => $v) {
|
|
@@ -314,6 +332,9 @@ class Auth
|
|
|
if ($v['auth']) {
|
|
|
$user['auth'][] = $v['auth'];
|
|
|
}
|
|
|
+ if ($v['auth_data']) {
|
|
|
+ $user['auth_data'][] = $v['auth_data'];
|
|
|
+ }
|
|
|
if (!$user['top'] && $v['top']) {
|
|
|
$top[] = $v['top'];
|
|
|
}
|
|
@@ -324,6 +345,7 @@ class Auth
|
|
|
|
|
|
$user['oper'] = implode(',', $user['oper']);
|
|
|
$user['auth'] = implode(',', $user['auth']);
|
|
|
+ $user['auth_data'] = implode(',', $user['auth_data']);
|
|
|
|
|
|
if (!$user['top'] && $top) {
|
|
|
$user['top'] = implode(',', $top);
|
|
@@ -337,6 +359,10 @@ class Auth
|
|
|
$user['auth'] = 'all';
|
|
|
}
|
|
|
|
|
|
+ if (strpos($user['auth_data'], 'all') !== false) {
|
|
|
+ $user['auth_data'] = 'all';
|
|
|
+ }
|
|
|
+
|
|
|
if (strpos($user['top'], 'all') !== false) {
|
|
|
$user['top'] = 'all';
|
|
|
} elseif ($user['top']) {
|
|
@@ -612,6 +638,23 @@ class Auth
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有数据权限列表,并进行统计处理
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function getByData()
|
|
|
+ {
|
|
|
+ $key = Dever::config('base')->manageAuthData;
|
|
|
+ $result = array();
|
|
|
+ if ($key) {
|
|
|
+ $result = Dever::load($key);
|
|
|
+ $result['state'] = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改当前管理员的密码
|
|
|
*
|