Log APEX User with Database Trigger
Hi all,
I'm writing a database trigger that save date/time and user that insert/last modify record on database. Because APEX authenticate database user but return always ANONYMOUS I've used this variables for doing it:
CLIENT_INFO... a variable with user name, CLIENT_INDENTIFIER... a variable with user name and session id.
I hope is usefull also for others.
Bye
Dario
Hi Scott,
I've tryed with it but my query goes wrong for object not find...
Where I wrong ?
Thanks a lot
Dario
Similar Messages
-
How to migrate Apex users with existing passwords.
Hi Guys,
Our apex env finally getting a upgrade from 3.1.1 to 4.1.1 (I know, it's been overdue for years)
Some of our apps use 'Application Express' authentication, and have few hundreds users in Apex (and users belong to diff user groups).
The issue is, the 4.1.1 env is set up on a brand new server and DB, we want to migrate these users with their existing passwords from the 3.1.1 env.
I tried exporting the workspace, and the users are exported as below,
begin
wwv_flow_fnd_user_api.create_fnd_user (
p_user_id => '10592934818556549584',
p_user_name => 'TEST',
p_first_name => 'a',
p_last_name => 'b',
p_description => '',
p_email_address=> '[email protected]',
p_web_password => 'E92903DEAD135E6E86BD6B64544D2BD9',
p_web_password_format => 'HEX_ENCODED_DIGEST_V2',
p_group_ids => '10592435401495787816:',
p_developer_privs=> '',
p_default_schema=> 'TEST',
p_account_locked=> 'N',
p_account_expiry=> to_date('201212040000','YYYYMMDDHH24MI'),
p_failed_access_attempts=> 0,
p_change_password_on_first_use=> 'Y',
p_first_password_use_occurred=> 'N',
p_allow_access_to_schemas => '');
end;
when I run this in 4.1.1 I had to modify it to the new format as below,
also changed the p_group_ids to new user group but kept the password the same
begin
wwv_flow_fnd_user_api.create_fnd_user (
p_user_id => '',
p_user_name => 'TEST',
p_first_name => 'a',
p_last_name => 'b',
p_description => '',
p_email_address=> '[email protected]',
p_web_password => 'E92903DEAD135E6E86BD6B64544D2BD9',
p_web_password_format => 'HEX_ENCODED_DIGEST_V2',
p_group_ids => '1399416797653068:',
p_developer_privs=> '',
p_default_schema=> 'TEST',
p_account_locked=> 'N',
p_account_expiry=> to_date('201209041006','YYYYMMDDHH24MI'),
p_failed_access_attempts=> 0,
p_change_password_on_first_use=> 'Y',
p_first_password_use_occurred=> 'N',
p_allow_app_building_yn=> 'N',
p_allow_sql_workshop_yn=> 'N',
p_allow_websheet_dev_yn=> 'N',
p_allow_team_development_yn=> 'N',
p_allow_access_to_schemas => '');
end;
the result was that the user is created fine, but the password is not valid.
Anyone knows how to export apex users with existing password to a new server?
Thanks.
Edited by: Danny on 3/12/2012 20:51Hi,
Not sure why you say
when I run this in 4.1.1 I had to modify it to the new format as below, If you just run the workspace export sql it should create the Workspace, Groups and Users
The signature of the procedure is below. See the highlighted lines.
procedure create_fnd_user (-- Description:
-- This procedure allows for programatic and bulk creation of users.
-- Example:
-- From sqlplus logged in as the privileged flows user, first
-- ensure that the security group id is set properly, then create
-- your users.
<b> -- begin wwv_flow_security.g_security_group_id := 20; end;</b>
-- begin
-- for i in 1..10 loop
-- wwv_flow_fnd_user_api.create_fnd_user(
-- p_user_name => 'USER_'||i,
-- p_email_address => 'user_'||i||'@mycompany.com',
-- p_web_password => 'user_'||i) ;
-- end loop;
-- commit;
-- end;
-- Arguments:
-- p_user_id numeric primary key of user
-- p_user_name the username the user uses to login
-- p_first_name informational only
-- p_last_name informational only
<b> -- p_web_password the unencrypted password for the new user</b>
-- p_group_ids A colon delimited list of group IDs from the table wwv_flow_fnd_user_groups
-- p_developer_privs A colon delmited list of developer privs, privs include:
-- ADMIN:BROWSE:CREATE:DATA_LOADER:DB_MONITOR:EDIT:HELP:MONITOR:SQL:USER_MANAGER
-- p_default_schema A valid oracle schema that is the default schema for use in browsing and
-- creating flows
-- p_allow_access_to_schemas A colon delimited list of oracle schemas that the user is allowed to
-- parse as. If null the user can parse as any schema available to the company.
-- This does not provide privilege it only resticts privilege, so listing a schema
-- does not provide the privilege to parse as a schema, it only restricts that user
-- to that list of schemas.
-- p_attributes_XX These attributes allow you to store arbitary information about a given user.
-- They are for use by flow developers who want to extend user information.
<b> -- p_web_password_format Identifies the format of the web password.
-- The range of values is CLEAR_TEXT, HEX_ENCODED_DIGEST, DIGEST </b>
-- p_person_type "E" marks the user as external
-->
Note there is no HEX_ENCODED_DIGEST, DIGEST_V2 listed. It may work, but not obvious from the signature.
Cheers, -
How i can associate my app user with database role
In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
Thanks,
Edwarduser8929172 wrote:
In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
Hi Edward
You can do this by assigning the role functionality to the application user. For example
create the table to enter user name.
create table to enter group name.
create table to assign user to group.
assign role to group.
assign functionality for the user by coding.
hope this helps -
Commit of master-detail view with database trigger on update
[ADF Jdev11 question]
My case is the following:
I have master form, with detail table attatched to it (using view link).
On update of master table, there is a database trigger which makes changes in the detail table.
As commit action commits both of the tables, as a result, I get the following exception:
"Another user has changed the row with primary key oracle.jbo.Key[000000002017 ]. "
Do you have any suggestions how can I fix this? Is there a way I can refresh the detail table just after the commit of the master table?
Marking the updated attributes with "refresh after update" doesn't help at all.This trigger is on update of the master table and that is what it does:
BEGIN
UPDATE detail_table
SET smolotpr = :NEW.molotpr,
smolpol = :NEW.molpol,
spoluch = :NEW.poluch,
sotpr = :NEW.otpr,
SMAKET = :NEW.MAKET,
sdata_period = :NEW.data_period
WHERE doknom = :NEW.doknom;
END;
Setting the updated attributes "Refresh after update+insert" to true doesn't help at all (maybe because they are in another table)!
I will be very grateful if you give me any ideas, advice or give the complete solution! -
Dear Sir….
How can I Macke log in user if success to page with
parameter.
I have DW SC4
Your reply it’s highly appreciates.
Regards;Please your help.
-
Using credentials of a logged in user with JMX (Admin console extension)
Hello,
I would appreciate any info regarding creation of a connection to the DomainRuntimeService MBean server in an administration console extension in BEA Weblogic 9.2.
The problem is that if I provide no security credentials, I'm not able to invoke any operations on the MBean server. Also the possibility of providing "default" user credentials within the extension "configuration" used to authenticate is not an option.
The most convenient way would be to use the same mechanisms used by the rest of the administration console, but there seems to be very little information around about where to retrieve the username/password used to log in to the console.
Thank you very much in advance, If you didn't understand my question, please ask for more information since English is not my native tongue.Hi,
Check the following wiki content submitted by Michael Nicholls:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/excel%252bspreadsheet%252bof%252bume%252bassignment%252bdata
The code for getting groups for your case (current logged in user) should be like:-
IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();
IUser user1 = clientUser.getSAPUser();
Iterator groups = user1.getParentGroups(false);
while (groups.hasNext()) {
IGroup group = groupFact.getGroup(groups.next().toString());
String groupname = group.getDisplayName();
Add this group name to a list
I do not have NWDS access at the moment so haven't checked it myself... you may try it out.
Also check out the following threads on the same issue:
Re: Get all Groups for current user
Re: Portal User and Role info -
Crystal Report Print Preview presenting users with Database Login
Issue
A user amended a crystal report form, on doing so has now made that Form unavailable to the majority of users to Print or Preview this is in 8.8 PL10. All other users on Previewing are presented with a window Database Login, but this only presents the server name, Database name is blank and greyed out and then there is only Login ID and Password available. If you enter in the database password a message appears stating failed login.
We have access to the SAP server and logged in and get the same message! but on the users machine who amended the Form they can print? any suggestions greatly appreciatedHi Roger,
The problem sounds similar to what I've had recently, it was resolved by changing the database connection type to SAP Business One in Crystal Reports 2008, I can confirm that using OLE DB or other will still cause the login issue on other machines off the SQL server, the SAP Business one connection solves the issue.
I was fighting with this for hours, hope this helps you all. -
Help with database autentication schemes
Hi
I am new to apex, especialy with database autentication schemes, and I need some help with creating login credentials for 3 types of users from a table in my database.
Any help and guidance would be apriciated.
Thanks in advance,
VoislavWhat Oracle Version you are using?
-
Grant role DBA with Database Vault
Hi all,
I need help granting the role DBA to a user with Database Vault option installed. I created a user account and I need that this user be able to do all the things that a regular DBA role can do. I can't find a way to do this in Database Vault... any help will be appreciated.
Thanks!Sysdba can issue powerful statements such as create user, drop user, alter user, create profile .. and so on... can be done only if it is allowed so by modifying the Can maintain accounts/profiles rule set.
You can also login with dvsys account but that account is locked after installation. So unlock it with
alter user username account unlock; command. And be aware that ANY system privileges are blocked in protected schemas. You can try to grant the following roles in DB Vault := DV_OWNER, DV_REALM_OWNER, DV_REALM_RESOURCE, DV_ADMIN, DV_PUBLIC, DV_ACCTMGR, DV_SECANALYST
Following can help you
SELECT TABLE_NAME, OWNER, PRIVILEGE FROM DBA_TAB_PRIVS WHERE GRANTEE = 'DV_ACCTMGR';
SELECT PRIVILEGE FROM DBA_SYS_PRIVS WHERE GRANTEE = 'DV_ACCTMGR';
Regards
Karan -
Read logged in user-works in Delphi7 but not in Delphi 2010
Hi all
I have some code I wrote a while back in Delphi 7 - simple program to read a currently logged in user IDs, read available class definitions, read some user attributes - relatively simple stuff. I am now trying to move to Delphi 2010 and the very same code that works on Delphi 7 does NOT work on Delphi 2010. The code was updated to compile and run on Delphi 2010, so it executes with no errors.
I am using NWDSWhoAmI to get the currently logged in user name and NWDSRead to retrieve user attribute values. On Delphi 7, the code works, all API return "Success" and return correct values. In Delphi 2010, all APIs return "Success" but the code act as if I am not logged in - the username returned is "[Public]" and when I try reading attribute values I get $8884 - RESOLVE SVC FAILED (also may mean I am not authenticated to the NDS tree).
The environment is XP and Novell Client 4.91 on the workstation, NW6.5 on the server (one sever tree). The code runs under the currently logged in user with full admin rights in the tree and Novell Client configuration on both workstations is identical. Any ideas on how to resolve this would be greatly appreciated.
Thanks
VladVlad,
since both Delphi versions go through the same DLLs it must be a difference
in the code - possibly different variable implementation as 16/32 bit or
signed/unsigned vars
It is good practice to use the NWLibrary defined variable types instead of
native Delphi types.
I have successfully used the same sources in Delphi 4, 5, 6, and 2010
Try my old samples:
http://support.novell.com/techcenter...a20020203.html and my Delphi
version independent Delphi libraries
http://developer.novell.com/wiki/index.php/Delphi-units
Wolfgang
"vladh" <[email protected]> wrote in message
news:[email protected]...
>
> Hi all
> I have some code I wrote a while back in Delphi 7 - simple program to
> read a currently logged in user IDs, read available class definitions,
> read some user attributes - relatively simple stuff. I am now trying to
> move to Delphi 2010 and the very same code that works on Delphi 7 does
> NOT work on Delphi 2010. The code was updated to compile and run on
> Delphi 2010, so it executes with no errors.
> I am using NWDSWhoAmI to get the currently logged in user name and
> NWDSRead to retrieve user attribute values. On Delphi 7, the code works,
> all API return "Success" and return correct values. In Delphi 2010, all
> APIs return "Success" but the code act as if I am not logged in - the
> username returned is "[Public]" and when I try reading attribute values
> I get $8884 - RESOLVE SVC FAILED (also may mean I am not authenticated
> to the NDS tree).
> The environment is XP and Novell Client 4.91 on the workstation, NW6.5
> on the server (one sever tree). The code runs under the currently logged
> in user with full admin rights in the tree and Novell Client
> configuration on both workstations is identical. Any ideas on how to
> resolve this would be greatly appreciated.
> Thanks
> Vlad
>
>
> --
> vladh
> ------------------------------------------------------------------------
> vladh's Profile: http://forums.novell.com/member.php?userid=84546
> View this thread: http://forums.novell.com/showthread.php?t=422167
> -
To verify plant of user (log on user) against plant data
Dear Guru,
In ABAP, How can I write code for verifying plant of user (log on user) with plant data in internal table. To check whether they are the same. Any good answer will be rewarded. Thank you very much.
Cheers,Hi
Check the SY-UNAME with the the name of the Plant user
Plant user data take it from T001W table
and All logon User data will be in USR02 table
take the data from corresponding tables and check.
Reward points for useful Answers
Regards
Anji -
How to Get the SSO Logged user information in database trigger
I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
thanksTry using portal30.wwctx_api.get_user returns a varchar2 (PUBLIC) or the Username that is logged in
I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
thanks -
How to get SSO logged user information in a database trigger
my database is 9i
my application server is 9i too
I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
thanksHi,
The only way I could figure out how to get it was to import the com.sap.security.api.
1. From Window>Preferences>Java-->Classpath Variables, set up a variable called WEBAS_HOME pointing to:
<drive>/usr/sap/<SID>/jc00/j2ee/cluster/server0/
2. Right click on properties of your Dynpro Project->Properties->Java Build Path->Libraries and click "Add Variable."
3. Select WEBAS_HOME and click "Extend"
4. Select /bin/ext/com.sap.api.sda/com.sap.security.api.jar and click OK.
If you don't have access to a portal directory, you will have to get this jar file and copy it to your workspace to add to your build path instead of the above steps.
Then in your code:
import com.sap.security.api.IUser;
import com.sap.security.api.IUserAccount;
public void GetLogonID( )
String LogonID;
try {
/* create an user object from the current user */
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if (user != null) {
IUserAccount acct = user.getUserAccounts()[0];
if (acct != null) {
LogonID = acct.getLogonUid();
} else
LogonID = "acct null";
} else {
LogonID = "user null";
wdContext.currentContextElement().setDisplayName(user.getFirstName() + " " + user.getLastName());
wdContext.currentContextElement().setLogonID(LogonID.toUpperCase());
} catch (Exception e) {
e.printStackTrace();
Hope this helps... I had to search several places before I found all the necessary stuff. Maybe I can get my first points!
Thanks,
Andrew -
Database Trigger gives error in APEX form
Hi
I have a table that has an on insert and on update trigger on the database table that is in the apex form. when applying changes or creating a new row fields are populated in the table for who and date. This works as expected but not in APEX.
in apex when trying to create or apply changes the following error is given
ORA-20505: Error in DML: p_rowid=hello, p_alt_rowid=ID, p_rowid2=, p_alt_rowid2=. ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "AIT_MSTR.UPDATE_ACCOUNT_ROW", line 9 ORA-04088: error during execution of trigger 'AIT_MSTR.UPDATE_ACCOUNT_ROW'
Error Unable to process row of table ACCOUNT.
I am not sure, but I think this error is around the DATE field in the row. How can APEX be modified to not error out on the execution of the trigger?
the trigger is very simple
CREATE OR REPLACE TRIGGER AIT_MSTR.UPDATE_ACCOUNT_ROW
BEFORE UPDATE
OF ID
,DESCRIPTION
,CONNECT_ONLY
ON AIT_MSTR.ACCOUNT
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
NAME: UPDATE_ACCOUNT_ROW
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 6/9/2011 1. Created this trigger.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: UPDATE_ACCOUNT_ROW
Sysdate: 6/9/2011
Date and Time: 6/9/2011, 11:39:59 AM, and 6/9/2011 11:39:59 AM
Username: (set in TOAD Options, Proc Templates)
Table Name: ACCOUNT (set in the "New PL/SQL Object" dialog)
Trigger Options: (set in the "New PL/SQL Object" dialog)
BEGIN
:NEW.Update_Date := SYSDATE;
:NEW.Updated_By := USER;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END UPDATE_ACCOUNT_ROW;
Any help is greatly appreciatedHi
Yes you are correct it was the length of the Created_by and Updated_by column. i had to increase the size of those columns in the table
Now it works.
HOWEVER, it is not capturing the user name of the person logging into APEX that is creating or updating the record. The entry I see in the created_by or updated_by is ANONYMOUS. Which is not want is needed to be captured and recorded. Where is this anonymous value coming from and how can i get it to be the id of the APEX user instead?
Any help is greatly appreciated on this new issue -
PROBLEM WITH A DATABASE TRIGGER
WHEN A USER ENTERS A STATUS CODE BETWEEN 70 AND 86 ON THE PAB_SUSP TABLE, THE COMPLETION DATE FIELD ON THE PAB_SUSP TABLE GETS UPDATED WITH THE SYSTEM DATE WHICH IS FINE. THE
COMPLETION DATE FIELD ON THE EREC_SUSP TABLE FOR THE SAME CORRESPONDING RECORD SHOULD ALSO GET UPDATED WITH THE SAME SYSTEM DATE. SOMETIMES THE COMPLETION DATE FIELD ON THE EREC_SUSP TABLE GETS UPDATED CORRECTLY WITH THE SAME SYSTEM DATE. OTHER TIMES IT DOES NOT. WHAT IS THE PROBLEM?
I AM ENCLOSING THE CODE IN THE DATABASE TRIGGER. NOTE ALSO THAT THE SUSP_DT FIELD ALSO GETS UPDATED.
DECLARE
cursor get_user is SELECT user_id, FROM oracle_user
WHERE username = USER;
user_number NUMBER(10,0);
num_recs NUMBER(10,0);
num_rec_recs2 NUMBER(10,0);
seq number(10,0);
ssn VARCHAR2(9);
nm VARCHAR2(27);
dob DATE;
pg VARCHAR2(2);
rank VARCHAR2(2);
act_cd VARCHAR2(3);
clk NUMBER(10,0);
recv_dt DATE;
susp_dt DATE;
cmpl_dt DATE;
ocll VARCHAR2(7);
tagd VARCHAR2(7);
chg_ind VARCHAR@(1);
BEGIN
open get_user;
fetch get_user into user_number;
close get_user;
IF (:new.lcl_pab_susp_stat_cd <> :old.lcl_pab_susp_stat_cd AND
:new.lcl_pab_susp_stat_cd >= '70' AND
:new.lcl_pab_susp_stat_cd <= '86') THEN
cmpl_dt := sysdate;
END IF;
IF :new.lcl_susp_dt <> :old.lcl_susp_dt THEN
chg_ind := 'Y';
susp_dt := :new.lcl_susp_dt;
else
susp_dt := :old.lcl_susp_dt;
END IF;
seq := :new.pab_susp_seq;
ssn := :new.ind_ssn;
nm := :new.ind_nm;
dob := :new.ind_dob;
pg := :new.ind_pg_cd;
rank := :new.mil_rank_cd;
act_cd := :new.lcl_act_cd;
clk := :new.lcl_act_clk_no;
recv_dt := :new.lcl_recv_dt;
ocll := :new.ocll_id;
tagd := :new.tagd_id;
SELECT COUNT(*) INTO num_recs2
FROM EREC_SUSP
WHERE SUSP_SEQ = :old.susp_seq;
IF num_recs2 > 0 THEN
UPDATE erec_susp
SET pab_susp_seq = seq,
ind_ssn = ssn,
ind_nm = nm,
ind_dob = dob,
ind_pg_cd = pg,
mil_rank_cd = rank,
erec_ofc_act_cd = act_cd,
erec_of_clk_no = clk,
lcl_cmpl_dt = cmpl_dt,
lcl_recv_dt = recv_dt,
lcl_susp_dt = susp_dt,
ocll_id = ocll,
tagd_id = tagd,
lcl_chg_ind = chg_ind,
rec_tx_dt = SYSDATE,
rec_tx_user_no = user_number
where susp_seq = new.susp_seq;
END IF;
END;S. Wolicki, Oracle wrote:
No, you cannot!!! NLS_CHARACTERSET is not a session parameter in Oracle.
Assuming IBM MessageBroker connects through OCI, setting the NLS_LANG variable in its environment to .EE8ISO8859P2 could help. You should also review MessageBroker's documentation, especially any configuration parameters for Oracle, to see if the character set is not configurable there. There is nothing to be done on the Oracle side.
By the way, can you name any particular characters that do not show up correctly and tell me what you see in place of them?
-- SergiuszHi Sergiusz,
I replace back and forth the accented characters, but for large queries, it takes a very long time:
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(c,'ő','ő'),
'Ő','Ő'),'ű','ű'),'Ű','Ű'),'é','é'),'É','É'),'á','á'),'Á','Á'),
'ú','ú'),'Ú','Ú'),'ö','ö'),'Ö','Ö'),'ü','ü'),
'Ü','Ü'),'ó','ó'),'Ó','Ã'),'í','í'),'Í','Í');
(The semicolons let down for display.)I thought that I would change the nls_lang on the client side in a Java node but it is not sure that will work.
Thank you for your answer.
Sada
Edited by: 1002028 on 2013.04.24. 13:48
Edited by: 1002028 on 2013.04.24. 13:49
Maybe you are looking for
-
The page numbers on my e-mail are missing, how do I get them back?
The page numbers are missing on my e-mail page and I have looked into help and cannot find the answer. I use to have 25 messages per page and now it is continuous and very annoying.
-
Inactivity timeout of connection pool - Sun ONE 7 and Oracle 8i
Friends, I have a JDBC connection configured, looked up by JNDI working fine with servlets. The question is: I have a firewall between my appserver and the database server that closes all idle connections longer than 10 minutes. The appserver assumes
-
Hi, We are getting the error "ORA-03106" The message is " Fatal Two Task Communication Protocol Error" The error ours only when trying out scheduled worksheet output for huge reports As it is very Urgent can anybody please help? Reply is highly appre
-
Admin server looses managed servers
we hava 2 clusters of 2 wls 6.1 sp2 instances each on 2 hpux 11 boxes. The wls console shows all the instances when booted up. But suddenly, after a period( and this random without a pattern), the admin seems to loose some of the managed servers. The
-
Problem in Adobe Interactive forms' Page breaks..
hi all, I am using Table wizard in the Form Builder to create a table. And i am binding the data to this table. The table which i have created will increase its rows dynamically depending on the number of records. The problem is the page break is not