Sunday, January 8, 2012

Making Admin Panel using YIi Framework

Recently, I have started coding in PHP. After coding for 2 -3 weeks, I started missing all those wild cards that frameworks provided me while coding in Java. All the basics things required in any project are taken care by those frameworks. We just need to configure and things are ready.
This magic of getting things easily made me to search for frameworks in PHP. Earlier, I have used Joomla and Code Igniter(CI). I believe Joomla is great CMS, but using it for any other purposes does not give me flexibility. Code Igniter, I used it long long ago. I came across article saying CI vs Yii vs Kohana. This comparison interested me to use Yii Framework. I found the documentation to be good and also community is good. I have started using this framework. I like the Active Record support which fills the space of hibernate framework.
First thing I started with is to create a admin panel. I got a very good link through google. It explains all and we can easily create Joomla kind of admin panel in our applications.
Link to tutorial : http://bit.ly/wCDLab

Saturday, December 31, 2011

Configure Database Server LoginModule Realm in Jboss AS 7

If we want to do a Database login for JavaEE6 application, We need to configure the DatabaseServerLoginModule of Jboss by creating a Realm. Put following lines in standalone.xml ( or domain.xml) :

 
   
    
          
               
               
               
               
               
          
     
  


Replace values with your respected values. If you are using custom database module class replace code="Database" with code="<your class name>"
Now the realm is configured into server, We need to tell our application to use this realm. This can be achieved using web.xml

 
  FORM
  MyRealm
  
   /login.jsp
   /loginerror.jsp
  
 
 
  SuperAdmin
 
 
  Admin
 
 
  Manager
 
 
  Employee
 
From lines 1 to 8 we inform the application to make use of FORM method to authenticate users with Realm MyRealm and also provide the login and error pages.
Next we need to declare the security roles in the application. We have declared 4 roles SuperAdmin, Admin, Manager and Employee from lines 9 to 20.
Now we have configured the application we will add security constraint in web.xml to our application as below.

  
   MyApplication
   /administration/*
   GET
   POST
  
  
   SuperAdmin
   Admin
  
 
 
  
   Unprotected area
   /resources/*
  
 
We added two security constraints. First is to allow only SuperAdmin and Admin to enter the admin panel. Another example is when you have protected entire site but want to allow access to resources to all.

11 Things every Software Developer should be doing in 2012.

Saturday, December 24, 2011

JPA Performance, Don't Ignore the Database

http://weblogs.java.net/blog/caroljmcdonald/archive/2009/08/28/jpa-performance-dont-ignore-database-0