-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
I need to set some authorization rule for my admin Resource for example hide some Resource from side menu and prevent access to it.
I read https://marmelab.com/admin-on-rest/Authorization.html and see this package https://github.com/marmelab/aor-permissions and also try this:
const App = () => (
<Admin
theme={ myTheme }
restClient={loopbackRestClient('http://0.0.0.0:3001/api')}
authClient={authClient('http://0.0.0.0:3001/api/Employees/login')}
>
{ permissions => [
permissions === 'admin' ? <Resource name="employees" icon={ EmployeeIcon } list={EmployeeList} show={EmployeeShow} create={EmployeeCreate} edit={EmployeeEdit} remove={Delete} /> : null,
<Resource name="projects" icon={ ProjectIcon } list={ProjectList} show={ProjectShow} create={ProjectCreate} edit={ProjectEdit} remove={Delete} />
]}
</Admin>
);
export default App;
I used below code in my LoopBack boot script to create my roles:
Role.create({
name: 'admin',
}, function(err, role) {
if (err) throw err;
...
But it's render below page after login with any user:

and this is my console error logs:
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
bundle.js:11865:10
Warning: Missing translation for key: "aor.page.not_found"
browser.js:49
Warning: Missing translation for key: "aor.message.not_found"
browser.js:49
Warning: Missing translation for key: "aor.action.back"
browser.js:49
uncaught exception: Unkown method
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels