Get frontend user machine name or ip or something unique to user in postgreSQL - postgresql

I am trying to make a audit table where every action on a particular table_A captured in other table_audit.
Unable to find any unique identifier which can be used to capture and decide so & so user had done this activity, something like this. Hope you get my requirement
Example: Employee/user whose companies laptop/machine name is 'JerryLap' apply for leave, i need to know capture 'JerryLap' and if he/she login and apply from different system with 'TomPC' then capture 'TomPC' and push it into database table with IP address.
Version: PostgreSQL 12.12 on x86_64-pc-linux-gnu

Related

work schedule for an employee is not set ZKTeco

device ZKTECO NX1200. I connect the device to a SQL database. set up a work schedule for an employee, but in the database in the CHECKTYPE column, the record O ( output ) is not displayed, instead of this there is Input. Help me please
enter image description here

Auto-update value in Postgres/TypeOrm

I have a table called customers which has a column called pin. A customer can generate this pin(from app) while making an offline purchase and give that pin at the POS/Kiosk to establish identity. This pin gets generated fresh every time a customer requests for it and is stored in the DB(in the customer table under column - pin) and is set to "null" again after payment confirmation.
However, if the customer generates a pin and does not make a purchase, the pin remains in the DB. I would like to know if there is any way to update this value to null after a certain time period without having to run a cron job or something or the use of a timestamp(if I should use a timestamp please let me know how).
I am using Postgres with TypeOrm on NestJs.
Any suggestions are welcome. Thank you.

Check for existing value inside of Firebase Realtime Database

Hello, I have a problem I created a Registration form and im trying to check if there is any user which have a certain username inside the Firebase Db. I tried to get the reference of all the users.
var users = Database.database().reference("users")
But I don't know how I could check if there is any user with a specified username.
You'll want to use a query for that. Something like:
let query = users.queryOrdered(byChild: "username").equalTo("two")
Then execute the query and check whether the result snapshot exists.
Note though that you won't be able to guarantee uniqueness in this way. If multiple users perform the check at the same time, they may both end up claiming the same user name.
To guarantee a unique user name, you will need to store the user names as the key - as keys are by definition unique within their parent node. For more on this, see some of these top search results and possibly also from here.

Laravel 5.1 Reset Password Function; user's email is in a different table

I have a question regarding Laravel's Reset Password function. I have thoroughly searched for a possible solution and could not find one. Moreover, I tried to scrutinize the code and manually implement it, but failed miserably because of the nesting. (I'm new to Laravel).
According to Laravel's documentation, the user's email must be in the table user in order to work and the error code confirms it.
*Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from user where email = usermail#provider.com limit 1*
However, we do have the scenario that an user might have multiple email addresses, hence stored in a different table called user_email.
Does anybody have experience with this scenario and could take the time to enlighten me on this?
You have two Options:
Write your own password recovery system.
Let the user choose a primary e-mail and make a column on the users table which represents the primary e-mail adresse.

Read only logic on the basis of user logged in to openbravo

I have a requirement in Openbravo 3.0 framework . I have two user one is HR and the other is employee . Their is a checkbox in user window called HR USER .. In my window I need to write a read only logic so that when HR logins the record has to be editable , and when the employee logins the record has to be non editable,, I know how to do that for normal fields ,, But i am not getting anything about user validation..
In the employee screen i am assigning the user id to that employee.
Please Help
Read Only Logic based on Logged in User:
finding out the ID (primary key) of the User (HR or Employee) using PGAdmin Query tool.
Add read only as shown below.
Read Only Logic based on Logged in Role :
This can be achieved in three steps
creating Auxiliary Input.
finding out the ID (primary key) of the role (HR or Employee)
associating Read Only Logic to the Column.
First of all, we need to add an Auxiliary Input that will make
AD_ROLE_ID of the currently logged in user available to the user
window. Using the System Administrator role navigate to the
Application Dictionary || Setup || Auxiliary Input and create a new
record as shown below:
This will make the #AD_ROLE_ID session variable available to the [user] tab of the HR User window through the #ROLE_ID# variable.
Secondly, you need to find out what the AD_ROLE_ID of the HR role
is. Use the PgAdmin to query the AD_ROLE table and find that out. A
simple query reveals the following:
select ad_role_id, name from ad_role;
ad_role_id | name
----------------------------------+---------------------------
....
1000001 | Admin
SDJFALSDFJKLASJDFKLASDFASLDFJAKLSJ| velmurugan
SDFLAKSDJFLKASJDLFALSDFALDSKFJLAS | Employee
DSKLFJAKLDSJFKLASJFKLADSJFLKAJSDFK| F&B US, Inc. - Admin
....
(38 rows)
The primary key (AD_ROLE_ID) of the HR role is 054A32701D6D4CE6BF4F695DAB23EDB3. This will clearly be different in your case.
With this information, we can now find the HR User field definition
and set its Read Only Logic to
#ROLE_ID#!'054A32701D6D4CE6BF4F695DAB23EDB3' as shown below: