APEX Developer Mode
When I used to work with Oracle Forms, the company I worked for used to grant users on the development environment with a special role which provided enhanced access to many areas of the system. The name of this role was called… GOD MODE.
This was only ever applied to the development system and it was a big help when supporting and developing the application.
I’m positive the name of the role was in reference to the massively popular video game Wolfenstein 3D; in which God Mode allowed you to walk through walls and maintain 100% health.
I’ve seen manual configurations such as granting roles, setting a data parameter or similar. But I really like the idea of automatic environment detection rather a manual configuration. I’ve seen URL detection before and this hasn’t worked out very well when the application is deployed behind proxies.
My method is based on an APEX feature which is directly responsible for the presence or absence of page components and therefore perfect for this example – Build Options.
A build option is simply a flag which controls what page components should be rendered when a page is displayed. Explorer make heavy use of this feature to control work in progress whilst releasing patches. However Build Options also have another handy setting called ‘Default on Export’.
I’m going to create a Build Option called ‘Development Mode’ (It was difficult; but I’m going to resist calling it ‘God Mode’ for the rest of this blog) which I want to enable for my application but disable on export. It’s that simple – now any component associated with it will run in my environment but not on any other.
Let’s try this – I’ve got a 3 page application; page 10, page 20 and page 30 (if this looks strange – then be aware this is the new 5.2 page numbering system when using the Blueprints) with page 30 being a kind of Developer Only debug page.
I have page 30 (and its menu entry) controlled by the “Development Mode” Build Option so it only appears on my development application; it’s excluded when I export which I preconfigured earlier, so I don’t really have to think about removal of this page too much.
With Developer Mode Enabled
Developer Mode Disabled
if ( $("#P0_DEVELOPMENT_MODE").length > 0 )
logMessage('Development Mode On');
The above is a simple example; although if you go down this route be security aware of what can and cannot be enabled by a hacker – always place conditions, authorizations and build options on any processes or dynamic actions which interface with the database. More on APEX security here here and here.
About the Author
Senior Oracle APEX Development Consultant
Explorer (UK) Ltd - Oracle award winning Platinum Partner
Matt is an experienced APEX solution designer having designed numerous complex systems using a broad range of Oracle Technologies. Building on his previous experience of Oracle Forms & PL/SQL, he is entirely focused on providing functionally rich APEX solutions.
Matt promotes APEX as a software platform and openly shares best practises, techniques & approaches. Matt has a passion for excellence and enjoys producing high quality software solutions which provide a real business benefit.