Autorizacion Esquemas - APEX (Authorization Schemes)

Hola a tod@s... Con todo el animo agregando un nuevo post, espero les sirva.. Saludos :)

En este post quiero compartir con ustedes como se agrega seguridad en una aplicacion apex, esto sirve bastante cuando se tiene ciertos permisos segun el tipo de usuario que va a acceder a la aplicacion.

Personalmente implemente dos formas se que hay otras pero estas hasta el momento me han servido. Si tienen mas avanzadas les invito a compartirlas. Bueno empezemos:

PRIMERA FORMA - CREANDO UNA TABLA DE USUARIOS EN NUESTRA BASE DE DATOS  

Prerequisitos:
  1. Tener la aplicacion creada. 
  2. Definir los roles a utilizar y que permisos va a tener cada rol 

Proceso:

Paso 1: Crear la tabla usuarios en mi caso: tape_usu_app Los campos que he utilizado son los siguientes: rol, nick, numAplicacion, nombres, estado

Paso 2: Crear el esquema de autorizacion
  1. Ir a "Shared Components" 
  2. Dentro del panel "Security" clic sobre "Authorization Schemes" 
  3. Clic boton "Create" 
  4. Seleccionamos "From Scratch", clic "Next" 
  5. LLenamos la siguiente información en el panel que se presenta:  
    • Name: Permiso_Administrador (Puede ser cualquiera)  
    • RequiredScheme Type: Seleccionamos "PL/SQL Function Returning Boolean"  
    • Expression 1: Llenamos codigo PL/SQL, puede ser asi: 
                   declare
                   permitido NUMBER;
                  begin
                            select count(usu_id)
                            into permitido
                           from tape_usu_app
                          where UPPER(nick) = UPPER(:app_user)
                           and rol = 'admin';

                           if (permitido = 1) then
                                  return false;
                           else
                                  return true;
                           end if;
                    end;

 
    • Identify error message displayed when scheme violated: Escriben un mensaje para el error puede ser "Acceso denegado" 
    • Clic boton Crear 
 Paso 3: Nos vamos a la pagina, item, lista o lo que queremos restringir por usuarios y nos ubicamos en la pestaña "Security o Authorization" segun el tipo de objeto que vayan a retringir En mi caso le voy a dar a una pagina esta en la pestaña "Security". Seleccionamos si queremos que tenga acceso el nombre de nuestra autorizacion pero si el lo contrario seleccionamos "Not + el nombre de nuestro esquema de seguridad".

En mi caso escojo en una pagina que sea solo para mi administrador "Permiso_Administrador" y en una pagina en donde sea solo permiso de mi usuario final "Not_permiso_administrador" Asi lo pueden hacer con cualquier objeto, recuerden todo depende del "if" de su funcion PL/SQL.  

SEGUNDA FORMA - CREAR USUARIOS CON LAS ABREVIATURAS DE LOS PERMISOS Y ROLES A UTILIZAR  

Prerequisitos:
  1. Tener la aplicacion creada. 
  2. Usuarios creados bajo un estandar en sus iniciales, por ejemplo: mis usuario administrador iniciar con ff_usuario1, y mis usuarios finales iniciaran con cc_usuario2 

Proceso:

Paso 1: Crear un esquema de autorizacion como en los pasos indicados en el paso 2 de la primera forma, solo que con la diferencia en la funcion de PL/SQL simplemente puede hacer una como esta:

declare 
caracter VARCHAR2(1); 
begin 
caracter := substr(:app_user,1,1); 
if (caracter = 'G') then 
return false;
 else 
return true; 
end if; 
end; 

Los siguientes pasos son similares a la forma anterior.

Eso es todo... espero les sirva.


Saludosss... Espero sus comentarios y porque no sus aportes.
Lindo dia.. y a disfrutar de la vida.. Dios los bendiga. :)

Comentarios

Anónimo dijo…

Sneakers shoes and ways to [URL=http://www.okay2shoes.net][b]gucci shoes for men[/b][/URL] discover the latest styles for women

Walking type products will feature different kinds of traction for the sole.This traction will help with slippery weather, hills, and rough terrain.The soles will also be made from good quality leather and be strong and durable.The top and side portion of the foot product will contain material that is durable and weather resistant.
A fashion shoe will simply contain a style and fashion without the comfort or cushion.These items are designed to look good.They may have a stylish pattern, color choice or appearance that makes them appealing.These products could be worn under a jean pant or any other kind of casual pant.While the item will feel comfortable to walk around in, it may not provide the comfort that could be required during jogs, or long walks.
Finding a good selection of footwear products could happen at many retailers.There are outlets available, and lots of retailers who only sell footwear products.These stores will offer a huge selection of running, walking and fashion type shoes.A customer may pick a style based on its colors and overall appearance.While the appearance will be an important factor, when a person tries on the product, it will need to fit right.Sales staff can also properly measure and fit a shoe to a particular foot and size.
When sneakers shoes are needed, consumers will be pleased with the selection available.These items will each have their own style and options available.A person who has a specific need for their foot product will find what they need.A good product will last a few months without losing its cushion or other special features.When hunting for the right shoe, a sales associate may be able to provide the proper sizing for the specific [URL=http://www.okay2shoes.net/nikeairjordanairjordan8-c-1_16.html][b]Cheap Nike Air Jordan[/b][/URL] foot.Some people need help with sizing and are not sure as to what size to get.


Entradas populares