akveo / ngx-admin-bundle-support

Support repository for ngx-admin backend bundles with issues tracking, instructions and code samples
58 stars 32 forks source link

Admin Role Example #6

Open worldfellow opened 5 years ago

worldfellow commented 5 years ago

Hi after purchasing node demo there is no admin based example there is just one file admin.gaurd.ts how should we use it also can we have a roles working example please

Cappmax commented 5 years ago

I also have no clue about this subject. How can one let appear the "Users"-button in the navigation pane? Do you have a bit more documentation how to set up users and roles ?

users-pane

I use your new released NODE_Starter Angular 8 + Nebular 4. Just a remark on the Release: the express server 'app.js' was not included in the package.

valentinkononov commented 4 years ago

@Cappmax I have uploaded fixed node_starter to the store, you should receive link to the updated package. Thanks for the issue, it helped me to fix our CI process.

valentinkononov commented 4 years ago

User Administration functionality (table with all users, all users editing for Admin role user) is available in full ecom node bundle. With full bundle you have Users menu and table out of the box.

The idea is to use roles mechanism of Nebular - docs

There is role schema setup in authModule, role.provider (reading role from JWT token), and usage of AuthGuard, AdminGuard and nbIsGranted directive to limit user access based on role.

unruledboy commented 4 years ago

@valentinkononov does full functions of User Admin come with .NET Core IoT Bundle?

unruledboy commented 4 years ago

@valentinkononov I bought the .NET Core IoT Bundle, but I could not see the users list, where is it?

unruledboy commented 4 years ago

@valentinkononov I figured it out, by adding UsersModule in pages.module.ts. Not sure it is the right way, though.

Actually, it will only work if I change the Discriminator of the admin user in table to be "admin" then the menu will show, but it will cause the login to fail.

I debugged it, FindByEmailAsync returns null, after turning on the EF Core debug, the SQL query is like this:

[u].[Discriminator] = N'User'

which means it is expecting the Discriminator to be user, NOT admin

unruledboy commented 4 years ago

@valentinkononov

And I keep getting the following errors, whenever I sign out and sign in again.

Also, looks like /api/network-aggregated?period=month RESTful API is not working. Is it possible you changed it to "energy-aggregated"? As you can see below, the "Traffic Consumption" is broken

image

image