Login page problem [message #405683] |
Fri, 29 May 2009 00:59 |
|
vamsi kasina
Messages: 2112 Registered: October 2003 Location: Cincinnati, OH
|
Senior Member |
|
|
Got a PM from aiznu
hi,
if u don't mind,can u help me to check my login page using form 9i.i was
create user nur identified by nur;
then i
create role admin;
grant dba to admin;
grant admin to nur;
and i also
create user aiznu identified by aiznu;
create role r_staff;
grant r_staff to aiznu;
in my form:
DECLARE
v_alert NUMBER;
BEGIN
if :USERNAME is null then
message('Username must be entered');
go_item('LOGON.USER');
return;
end if;
if :PASSWORD is null then
MESSAGE('Password must be entered');
go_item('LOGON.PASSWORD');
return;
end if;
IF (:counter < 3 ) THEN
:counter := :counter + 1;
LOGON(:USERNAME, :PASSWORD || '@'||'DBA', TRUE);
:GLOBAL.USER := :USERNAME;
:GLOBAL.PASSWORD := :PASSWORD;
BEGIN
SELECT ROLE
INTO :GLOBAL.v_role
FROM SESSION_ROLES
WHERE ROLE IN ('ADMIN','R_STAFF','R_MEMBER');
IF (:GLOBAL.v_role='R_STAFF' ) THEN
NEW_FORM(:global.Form_Path ||'main.fmx');
ELSIF (:GLOBAL.v_role='ADMIN') THEN
NEW_FORM(:global.Form_Path ||'admin.fmx');
ELSIF (:GLOBAL.v_role='R_MEMBER' ) THEN
NEW_FORM(:global.Form_Path ||'membermain.fmx');
END IF;
EXCEPTION
WHEN OTHERS THEN
v_alert:=Show_Alert('LOGON_FAILURE');
:USERNAME :='';
:PASSWORD :='';
END;
ELSE
LOGON(:USERNAME, :PASSWORD || '@'||'DBA', FALSE);
v_alert:=Show_Alert('ATTEMPT_FAILURE');
:USERNAME :='';
:PASSWORD :='';
IF v_alert=ALERT_BUTTON1 THEN
--Exit_Form;
NEW_FORM(:global.Form_Path ||'logon.fmx');
END IF;
END IF;
END; to login using user aiznu..it success.
but using nur.. it can't go to admin.fmx. can't error but can't display the admin.fmx.
can u help me?
|
|
|
|
Re: Login page problem [message #405707 is a reply to message #405695] |
Fri, 29 May 2009 02:53 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
Quote: | Remove WHEN OTHERS and try again.
|
when remove that.has error frm-40735:when-button-pressed trigger raised unhandled exception ORA-01422
Quote: | "SELECT ROLE FROM SESSION_ROLES statement" might end up with TOO MANY ROWS exception.
|
i have using where clause
Quote: | Also, you've created role named "r_staff", but nothing is granted to it. Then it is granted to user "aiznu"; is that what you meant to do?
|
role r_staff was grant to user aiznu..
n the questions is.. when i login using this syntax.. as user aiznu.. the form go to main.fmx but why when i login as user nur..
it's go to this error
EXCEPTION
WHEN OTHERS THEN
v_alert:=Show_Alert('LOGON_FAILURE');
:USERNAME :='';
:PASSWORD :='';
END;
|
|
|
|
Re: Login page problem [message #405783 is a reply to message #405716] |
Fri, 29 May 2009 07:27 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
yes i know..the WHERE clause is return single record. but when use WHERE <column> IN <name in column> -> its definite to admin,r_staff and r_member.
SELECT ROLE
INTO :GLOBAL.v_role
FROM SESSION_ROLES
WHERE ROLE IN ('ADMIN','R_STAFF','R_MEMBER');
r_staff and r_member have a privileged. for example i put GRANT SELECT, INSERT, UPDATE ON SUPPLIER TO R_STAFF;
so the role to log in using role r_staff and r_member is success. but role using admin is not success to log in.i don't because the coding is same.
|
|
|
|
Re: Login page problem [message #405837 is a reply to message #405831] |
Fri, 29 May 2009 21:28 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
I get this result:
SQL> conn nurul/nurul@dba
Connected.
SQL> select role
2 from session_roles
3 where role in ('ADMIN', 'R_STAFF', 'R_MEMBER');
ROLE
------------------------------
R_MEMBER
R_STAFF
ADMIN
|
|
|
|
Re: Login page problem [message #406036 is a reply to message #405917] |
Mon, 01 June 2009 20:13 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
can u explain me step by step where i want to put the PL/SQL statement? i don't understand n i not skillful in PL/SQL statement.its in when-button-press that i put the login statement or in PL/SQL libraries?
|
|
|
|
|
|
Re: Login page problem [message #406061 is a reply to message #406058] |
Tue, 02 June 2009 00:18 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
do you mean like this?
SQL> declare
2 l_role session_roles.role%type;
3 begin
4 select role
5 into l_role
6 from session_roles
7 where role in ('ADMIN', 'R_STAFAF', 'R_MEMBER');
8 end;
9 /
declare
*
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 4
or
SQL> CREATE PROCEDURE ROLE_PROC
2 declare
3 l_role session_roles.role%type;
4 begin
5 select role
6 into l_role
7 from session_roles
8 where role in ('ADMIN', 'R_STAFAF', 'R_MEMBER');
9 end;
10 /
Warning: Procedure created with compilation errors.
|
|
|
|
Re: Login page problem [message #406092 is a reply to message #406062] |
Tue, 02 June 2009 03:26 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
Thank you for helping me.. i think this my mistake about the user that i had grant. thank you especially to Littlefoot and vamsi kasina.now i success to login any user.
but i have another question.. when user login such as nur and she want to see the staff information.the form will be display her information only.not another user information.how can i apply?
[Updated on: Tue, 02 June 2009 03:57] Report message to a moderator
|
|
|
|
Re: Login page problem [message #406104 is a reply to message #406102] |
Tue, 02 June 2009 04:29 |
aiznu
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
The information that i mean is in staff table have name,address,phone,hiredate. So if user nur login, the form appear the detail about her only.
|
|
|
|
|
|
|