Profiles in Angular - html

I need help in understanding how to create profiles using the Angular framework. The idea would be, when signing in, the website changes based on the profile that’s logged in. I created a create profile component and I also created the login screen that verifies the profile that was created. But I’m having a hard time wrapping my head around how to change certain components based on the profile. Is it as simple as just creating a “logged in” component and importing it into the components that change based on the user that logged in?

You should create a profile component, that takes as an input the user, and bind the informations to the view.
Then you can use the component inside another component that as the user isntance.

A good way is to create a service instead of that component.

Related

Pager controls are hidden in ABP user admin list

The Administration > Identity Management > Users page only shows the first 10 users in the list. The pager control exists in the DOM but it's hidden. Is there any way to unhide the pager?
This seems to be due to the maxResultCount that's sent in the request. Is there any way to override that without implementing a custom version of the User Management page?
This app is just using the default identity module. I'm hoping there's some simple way to fix this without using a custom users page.
You have 10 users in total, when you add a new user, it should appear on your page.
enter image description here

How to Show/Hide button based on Profile in Salesforce LWC

I have develop LWC component which is normally used by normal users. In that lightning web component button is there as below.
<lightning-button slot="actions" label="Deactivate" onclick={DeactivateProcess}>
</lightning-button>
The above button should be only be show to System Admin Profile and Business Admin Profile. How to show the button only to those two Profiles without using record types or different page layouts?
I think this is not a good idea to get current user profile from lwc. Because User and Profile are two different object in Salesforce. You can only get user profile id by import it.
import PROFILE_ID from '#salesforce/schema/User.ProfileId';
Try to use apex and soql query for getting current user profile.

i want to restrict route access based on role

i want to provide role based route access e.g there is two types of user 1.Admin and 2.normal user.
if normal user try to access admin pages through url then user will redirects to dashboard page and same case for admin.
This is quite a lot of code you're asking for.
One thing you need to look into is Route Guards which let you protect access to routes based on your own written criteria:
https://angular.io/guide/router#milestone-5-route-guards
You also need to pick a way to manage your roles and users. A popular way for Ionic is to use Firebase:
https://firebase.google.com/
A great tutorial for setting this all up is over at AngularFirebase.com (currently rebranding to Fireship.io).
It's a long tutorial, and you will need to follow an additional tutorial for setting up the login system as well, but it will get you to where you want to be.
Role Based Authorization With Firestore and Angular

MVC, Swing, Observer Pattern Design Decision

I am trying to implement a small application using Swing and MVC Design Pattern with MS SQL Server as the backend.
The application starts with a simple login form. Also there are two kinds of roles for the users of the application.
Administrator: Can create, delete, modify, view all users plus all the functionality the application provides.
Application Users: Can only use the functionality the application provides.
I'm thinking to have two separate Frames i.e. UI for each role.
The main login form/GUI acts as a view, with a Login controller class which registers the view using Observer pattern. The button registers the event, which the controller listens, calls the appropriate DAO to connect to database and verify if the user can log on to the application.
The stored procedure for login returns access_role i.e. either administrator, application user, unknown user or non-authenticated user which is returned through DAO back to Login Controller.
I want to keep the coupling as low as possible, hence the separation of concerns and MVC design with Observer Pattern.
Now my questions are,
Should the Login controller decide based on the access_role returned to show either the application user UI or the Administrator UI or should it pass that information back to the Login UI which should initialize the respective GUI ?
If the Login Controller should decide which UI to initiate, then it would need to set all listeners as well for the respective GUI? Is that a good design decision or is there a better way of doing this?
If the Login Controller passes the access_control back to the Login Form, then that Login Form would have to initialize all the Listeners for the new GUI and instantiate the new GUI as well? Is this better than the controller doing the stuff?
Should the UI for Administrator and Application User be JFrame or Dialogs ?
Hoping to hear your views about it.
Best regards,
Kashif Khan
I'm not sure if I would want the Login Controller or the Login UI initialize a different part of my application. In the interest of keeping things decoupled I would want the Login stuff to handle no other function but logging in a user. It might be a good idea to have like a Application Controller that initializes the Login part of your application and when it authenticates a user pass that message back to it which will decide which GUI needs to be initialized next.
As stated in part 1, the the Login Controller should just pass a message back to the Overall Application Controller which will make a decision on which part of the Application needs to be initialized next.
It would seem out of scope of the Login Form to handle all of these actions. The Login form should merely just communicate to the Application controller whether login was successful or not and some basic information about the user so additional information can be gathered as needed from the database on during the next part of initialization.
From the JDialog Oracle Documentation "A Dialog window is an independent subwindow meant to carry temporary notice apart from the main Swing Application Window" This being said you wouldnt want to use Dialogs for your main application. You could however use a Dialog for the Login form if you chose to and that would be acceptable.
I hope this helps.

How to save a web-application state dynamically?

I would like to create a web application where a user can drag and drop images and text onto a div or similar container. Then, when the user clicks a save button, the application would be able to save the content of the dropped items, as well as the positional information for those items.
Ultimately the user should be able to come back, open then application, and have the images and text back in the exact same places as when they were saved.
If anyone knows a methodology or framework that could assist in accomplishing this, it would be appreciated.
When the user hits the save button, you will need to collect the dynamic state of the current web page (which sounds like images and positions) and send that to your server with some sort of user id that uniquely and securely identifies this user. The next time that user loads this web page, you can either put the state into the web page as it is retrieved from the server or you can use client-side javascript to retrieve that user's state from the server and then dynamically modify the page to match the desired state.
You can save the state to the server with either an ajax call or a post. You can retrieve the state from the server from the client javascript using an ajax call or if the state was already put into the web page by the server, you can just refer to it there.