Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
export function getPermissions() { let userPerms; // In our example we using stor as a single source of truth. // Full implementation can be found here https://github.com/danduh/ngx-to-do-permissions. const store: Store = AppInjector.get(Store); store .pipe( select(userPermissionsState), take(1) ) .subscribe((_p) => { userPerms = _p ? _p : {}; }); return userPerms; } export function checkPermissions(required: string, userPerms) { // 1) Separate feature and action const [feature, action] = required.split('_'); // 2) Check if user have any type of access to the feature if (!userPerms.hasOwnProperty(feature)) { return false; } // 3) Check if user have permission for required action if (!userPerms[feature].hasOwnProperty(action)) { return false; } return true; }
Related posts
- Show HN: Composable (as in iGoogle, but modern) privacy-friendly new tab
- GPT-4 Turbo with Vision is a step backwards for coding
- Llama 3 with open source code interpreter
- Using AWS Lambda and CloudFront to optimize image handling
- Ask HN: Can anyone suggest few open source projects for SaaS Boilerplate?