row level security and check duplicate - spring

I create an application with spring boot and Postgresql. I use Row Level Security of posgresql to "secure/limit" the data of connected user.
(I use JdbcInterceptor to add "set role" on each session and "reset role" after)
My problem:
I want to check duplicate before insert and duplicate can be on data which user cannot see.
For exemple, user can only access to his email, he can create a new email, but before create, if want to check if email doesn't exist in the database.
Do you have an idea how i can do that?

Related

How to add user to my own database after supabase creates new users

I am new to supabase. When a new user signs in or signs up in supabase, I want to add the user to my own database.
I've tried creating a public.users supabase database using triggers when a new user joined. And created a database function on the updation of public.users database to hit an endpoint, creating a user in my database. This looks complicated. Are there any other ways to simplify this process?

Spring boot disable user

Good morning. Question scenario is as follows. Suppose an employee with a role goes to annual leave and he has an account in a spring boot application. How can I disable his user account so that logins fail at that time. How do I write the code? I'm using WebSecurityConfigurerAdapter but I failed to accomplish this task. I need sample working code using preferably Spring boot 2.6.* cause other resources I found on the net are using older versions.
Thanks in advance.
If you want to disable a user for a certain period of time where the user can not log in till u enable his ID, then I assume that u created a table of name "User" where you store all user credentials, specify two more columns "role" and "isActive(boolean)", in "role" column you can specify your role as ADMIN or ROLE_ADMIN and write a code with logic where an admin has all authorization, as an admin you can alter the data, before that you should write a code for only active users can log in, then as an admin, you can change the state from "true" to "false" in the specific user's "isActive" column, now the user only able to login if his "isActive" state is true.
you can ping me any time...

UiPath - Search role in web table and select it if exist

I’m working in a process to delete roles for several users (500).
I did a process, but I’m seeing it isn’t working well. Only select the checkbox Role, if it is in the beginning.
I’ve created a DataTable, This DataTable contains base information with user_id, my key field to find this particular role and delete it.
In this process, I need to access each user to browse his roles. All roles change according to the user.
My problem is how can I browse the (web table) roles, find and select the correct role, through its checkbox.
Here an image with three cases that could be appears:

User registration validation through email with Spring Roo

I want to add a feature to my spring roo project. I have an user entity that logs into the application and adds additional users.
When I add those users there is an email adress(field) on which I want to send the validation with additional link to activating the account. Also the user has a field that represents if he or she has an active profile in a way is it possible to log in or not - this field needs to change after I click the provided link in the email.
I already have an velocity templates and everything set up, I just need the process of forming that link and assuring that the user will have an active account after clicking on it.
I solved this using a REST call and Spring Security. When the user first signs up, you create the UserDetails object (mine was in a DB table), but set it as not enabled before you save it (there are 4 booleans in the UserDetails object you can manipulate to enable/disable the user in various ways that Spring Security checks). I also stored a UUID code I generated off the user id in a table, and then generated an email which included a link to the REST service to validate the account.
The REST service was simple. The user clicks the link, which would include the UUID code I generated. You could optionally require them to enter some number or do something here as another authentication step, but in my case I simply looked up the UUID to get the associated UserDetails, flipped the bit to enabled and saved it, and sent them to a page saying their account was now active. I then did something like in this post to auto-login the user.

Prevent multiple login from a user in the same session

How to prevent multiple login from a user in the same session in Wicket?
you can create a table in your database to hold the ids of logged in users.
when a user logs in check if his id is in said table
otherwise insert his id into that table.
you also need to remove the user's id from the table once user logs out
you can integrate spring security with wicket. Spring security handles it automatically.

Resources