4.6.201909261437 • Published 5 years ago

@dfeidao/fd-am000021 v4.6.201909261437

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

检查当前登录用户页面权限

Installation

yarn add --dev @dfeidao/fd-am000021

Description

检查当前用户是否可访问当前页面。

如果当前用户没有访问权限,可以将其导向登陆页面,或者在渲染“没有权限查看/访问”之类的内容。

Example

import am00 from '@dfeidao/atom-mobile/interfaces';
import am21 from '@dfeidao/fd-am000021';

export default async function a001(fd: am00) {
	const has_right = await am21(fd, 'web_test');
	if (has_right) {
		// todo
		// use could access this page.
		// do the normal logic here
	} else {
		// todo
		// maybe we should exit app, or direct to login page, or just render 'You have not got right to access this page, Please contact administrator.'
	}
}