MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / authorize

Function authorize

src/components/Authorized/Secured.jsx:48–68  ·  view source on GitHub ↗
(authority, error)

Source from the content-addressed store, hash-verified

46 */
47
48const authorize = (authority, error) => {
49 /**
50 * conversion into a class
51 * 防止传入字符串时找不到staticContext造成报错
52 * String parameters can cause staticContext not found error
53 */
54 let classError = false;
55
56 if (error) {
57 classError = () => error;
58 }
59
60 if (!authority) {
61 throw new Error('authority is required');
62 }
63
64 return function decideAuthority(target) {
65 const component = CheckPermissions(authority, target, classError || Exception403);
66 return checkIsInstantiation(component);
67 };
68};
69
70export default authorize;

Callers

nothing calls this directly

Calls 1

checkIsInstantiationFunction · 0.85

Tested by

no test coverage detected