I recently came across StrongLoop and am thinking of porting my existing app to it. However, I am unable to wrap my head around how the following scenario can be catered for:
My app is supposed to have two distinct regions Retailer and Customer. The UI and functionality for Retailers is very different from that for Customers.
The users, on the other hand, can have the roles Retailer, Customer, and even both Retailer and Customer. So when a user tries to log in, I check what roles she has assigned. If she has a single role, I redirect her to the appropriate section of the site.
If, however, she has multiple roles, I need to present her with a list of roles assigned to her where she needs to make a selection what role she wants to assume for this login. If she selects Retailer, I should redirect her to the Retailer section of the app where she should only be able to post products (let's say). If she selects Customer, I should redirect her to the Customer section of the app where she can only view the products posted by all retailers.
In a StrongLoop world, is there any way I can achieve this?
Related
i use leaflet, geoserver and js. And also using tomcat
I have more than 400 users and each has its own role, adding more than 400 users to geoserver and configuring them individually is too long.
The user is currently logged in like this:
The question is, if there is any way to get the data of an authorized user and apply roles and filters to it?
I will also say that the users are in the postgres database
Adding an authentication using a JDBC database to GeoServer is a very similar process to adding an LDAP provider. While logged in as admin go to the User, Groups and Roles page from the security menu and choose Add new from the User Group Services menu. Then select the JDBC option, you can then give this provider a new name.
Then you should select the relevant JDBC driver for your database (you may need to add the jar containing that driver to the GeoServer WEB-INF/lib folder). You then need to add the connection URL for your database (e.g. jdbc:postgresql://localhost:5432/ian). It is probably a good idea to make a quick test using a known user password combination in the boxes below. Assuming that works click save to make the change. If you don’t already have any tables with users in then check the create database tables box (don’t worry about the DDL files). Then press save, and go back into the service by clicking on it’s name in the table.
You can then add new roles to the service. Now, you need to create a new Basic username/Password authentication provider. You will now need to scroll down to the Authentication providers panel and move the new provider across to the right hand list. You then need to click on the new provider and set the User Group Service to point to the JDBC one you just created.
There are many more instructions and tutorials in the GeoServer manual.
On my website, I have two portals for login. Portal A is login for learners. Portal B is login for teachers.
Both learners' and teachers' accounts are located in the same Firebase project, in another words, both types of accounts are located in the same authentication space. Both portals use the same simple login code:
firebase.auth().signInWithEmailAndPassword(user_email, user_password).catch(function(error) {})
Currently, the learners can login at both portals, and same for the teachers. What I am trying to do is to prevent the teachers to login at the learners' portal and vice versa. I am not sure how to implement this. I have made a setCustomUserClaim to give an identity to the two types of accounts on the authentication token. But I can only grab the auth token once the user is logged in, not before I think. Also, I have a Firestore collection that stores all the info of the users including their identity. But each user's document is named with their corresponding UID. The latter can be grabbed once they login in as well. Any idea on how to implement this?
Firebase Authentication has no built-in way to distinguish between these two types of users. It simply authenticates the credentials that a user enters, and ensure that they're correct. If certain users can only access a certain application or certain data, this is information that will have to come from you.
The above is important to realize, so I'll repeat it: Firebase Authentication allows all users to authenticate as long as they provide the right credentials. It has no way to block access to authentication based on application-specific information, such as your user-type. This type of authorization logic is part of your application, both in code and (if you use a Firebase Database) of your server-side security rules.
A common way to implement your scenario is to add the information about the types of users to a database (such as Firebase's Realtime Database, or Cloud Firestore). In this data you could for example store the email addresses of all teachers.
Now with this information, your code can then determine whether the person who signed in to the site is a teacher or not. If they're a teacher signing in to the student web site, you can redirect them, and vice versa.
In my app I need to find a way to connect users with their facebook ids (or something, that will identify them later). Will try to explain:
As a user,I'm create an event, and mark participants by enter their names.
Some of participants are already sign up in my app, some of them not.
To identify participant (no matter, registered or not),I have planned to use their facebook ids. Currently,I want add links to their profiles under names.
So, is there a way to get facebook id of user, by his profile link (https://facebook.com/zuck)? Or any other way to identify user via facebook, no matter registered he in app or not.
UPDATE Looks like there are no way to use facebook IDs for this task. Maybe there are another identifier to uniquely link account with facebook?
I implemented friendly chat. But that is group chat. I am new to firebase. Need docs for creating one to one web chat. How to get list of user accounts and selecting single user to send message? Please help me
If the users communicating have user IDs uid_1 and uid_2.
The database structure should be:
contacts
--uid1
--uid2
--uid3
-- so on (1)
--uid2
--uid1
--uid4
-- so on (2)
messages
--uid1
--uid2
-- Push messages here.(3)
--uid2
--uid3
-- Push messages here also.(4)
Adding Contacts
If USER 1 knows USER 2 you can add USER 2 in location (1) and add USER 1 in location (2). Since you are implementing with user IDs the USERS will be able to send messages if they know the other USER's uid. You can send Chat Invites to exchange uids.
Adding Messages
If USER 1 or USER 2 sends a message add at locations (3) and (4). This implementation will make sure that even if USER 1 deletes a conversation with USER 2, USER 2 will still have a copy and thus ensuring privacy.
These are the key elements to make a basic one-on-one Firebase Chat App.
NOTE: User IDs are provided by Firebase on successful authentication.
Maybe try breaking your problem into individual milestones and learn how Firebase works as you need help in each milestone.
According to what you have written, you have to:
Authenticate Users (https://firebase.google.com/docs/auth/)
Save those user profiles onto the Real-Time Firebase Database in the following data structure (https://firebase.google.com/docs/database/)
List those users in a List / RecycleView (learnhowtoprogram.com/android/data-persistence/firebase-recycleradapter)
Manage the conversation through listeners in the adapter that reference child nodes which serve as rooms between 2 people.
Think about how to make your structure as efficient as possible such as not saving conversations twice under each user but rather saving a reference to a separate 'conversations' node.
I recently implemented this in my location-based app (Occupapp) if you want a live example. You will have to register, add a service and log in from another device and select that service to chat to the owner.
Here is the scenario:
There are two types of users: user one and user two. user two has more privileges
When someone wants to sign up to my website he can choose to be user one or user two in signup template (radio buttons) .
if he/she choose user one, a user record will be created in the database and he/she can use limited functions.
If he/she choose user two, a user record will be created and it will be disabled (can't login) until the admin approve the account. Then he/she can use the full functions of the website.
the questions is how to implement it using accounts:ui package if it is possible.
You can build your own additions on top of Meteor's standard accounts system by storing extra fields on Users collection's objects, such as "role" or "privileges", etc.
Or you can use a package that already covers a lot of common cases like this roles package.