Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
...nobody




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseSecurity


Difference between version 16 and version 15:

At line 94 changed 1 line.
__TODO:__ This is done in CVS, now I just need to document it. In CVS, it's only done for Struts - I still need to do it for iBATIS and the other web frameworks.
In order to hook into Acegi Security without changing much code, I did have to add a "enabled" property to the User object. This affects several areas of an AppFuse application. You will need to modify your code in the following areas to handle this.
At line 96 changed 4 lines.
* Enable user as part of Signup Process
* Add "enabled" column to the sample-data.xml and enable all users
* Add key for "user.enabled" label to ResourceBundles
* Add checkbox to userForm page for enabling/disabling a user
1. Add a "enabled" variable to the User.java class, including getters and setters. Also add this variable to the equals(), hashCode() and toString() methods.
At line 98 added 50 lines.
[{Java2HtmlPlugin
protected Boolean enabled;
/**
* @return Returns the enabled.
* @hibernate.property column="enabled"
*/
public Boolean getEnabled() {
return enabled;
}
/**
* @param enabled The enabled to set.
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
}]
%%note If you're using iBATIS, you will need to add the "enabled" column to the SQL in UserSQL.xml. You will also need to add "enabled bit" as a column definition for the "app_user" table in metadata/sql/mysql-create-tables.sql.%%
2. In your controller/page class that handles signup, enable the user before they're saved:
[{Java2HtmlPlugin
user.setEnabled(Boolean.TRUE);
}]
Another thing you could do is leave them disabled and change the e-mail that's sent go to an administrator. Then the administrator can enable them and send an e-mail. The above behavior is to keep consistency with current AppFuse functionality.
3. In metadata/sql/sample-data.xml, add an "enabled" >column> to the "app_user" table. This should have a <value> of "1" for all users - so they're enabled and can login.
4. For all the languages/ResourceBundles your application supports, you need to add a label key to display this property on the UI. Below are the translations for the default ResourceBundles. If you're using Struts, this key should be "userForm.enabled" instead of "user.enabled".
* __ApplicationResources_en.properties:__ user.enabled=Enabled
* __ApplicationResources_es.properties:__ user.enabled=Permitido
* __ApplicationResources_fr.properties:__ user.enabled=Permis
* __ApplicationResources_nl.properties:__ user.enabled=Toegelaten
* __ApplicationResources_pt_BR.properties:__ user.enabled=Permitido
* __ApplicationResources_zh_CN.properties:__ user.enabled=使能
5. When editing a user's record, an administrator should be able to enabled/disable a user. When a user is editing their own profile, the disabled field should be hidden, so they cannot edit it. Below are links to the CVS diffs for the various frameworks to show you what you need to change.
* [Struts|https://appfuse.dev.java.net/source/browse/appfuse/web/pages/userForm.jsp?r1=1.12&r2=1.13]
* [Spring MVC|]
* [WebWork|]
* [Tapestry|]
* [JSF|]

Back to AppFuseSecurity, or to the Page History.