talefun-rbac

npm install talefun-rbac --registry http://registry.talefun.com:4873

Usage no npm install needed!

<script type="module">
  import talefunRbac from 'https://cdn.skypack.dev/talefun-rbac';
</script>

README

Component publish build Template

npm install talefun-rbac --registry http://registry.talefun.com:4873

Server端

class Test {

    @AutoAuthService
    public async infoAction(a: string, b: number, auth?: GetUserAuth) {
        let auth:object = await auth.getAuth(2);
    }

    // or

    public infoAction(a,b){
        let auth:any = (new GetUserAuth).getAuth(1);
        if(auth.noAuthority.indexOf('/test/info') !== -1){
            // location ... ro set response body xxx;
        }
        // is next ...
    }
}

React front-end

@AutoAuthService('/test/info',async (a,b)=>{
    // this === (Test class)
    let auth:any = (new GetUserAuth).getAuth(1);
    return await <div></div>;
})
export class Container extends React.PureComponent<Props, State> {
    render(){
        return (
            <div>
            </div>
        )
    }
}