Permalink
Browse files

Work on authentication

  • Loading branch information...
1 parent a236483 commit 8c99193f8e38a95dae8927a96ee7e99a245f4c65 @jcosmo committed Jun 20, 2012
View
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+gem "buildr", "= 1.4.7"
+
View
@@ -0,0 +1,56 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ atoulme-Antwrap (0.7.2-java)
+ bouncy-castle-java (1.5.0146.1)
+ builder (2.1.2)
+ buildr (1.4.7-java)
+ atoulme-Antwrap (~> 0.7.2)
+ builder (= 2.1.2)
+ diff-lcs (= 1.1.3)
+ highline (= 1.6.2)
+ hoe (= 2.3.3)
+ jruby-openssl (>= 0.7)
+ json_pure (= 1.4.3)
+ minitar (= 0.5.3)
+ net-sftp (= 2.0.5)
+ net-ssh (= 2.3.0)
+ rake (= 0.9.2.2)
+ rspec (= 2.9.0)
+ rspec-core (= 2.9.0)
+ rspec-expectations (= 2.9.0)
+ rspec-mocks (= 2.9.0)
+ rubyforge (= 2.0.3)
+ rubyzip (= 0.9.4)
+ xml-simple (= 1.0.12)
+ diff-lcs (1.1.3)
+ highline (1.6.2)
+ hoe (2.3.3)
+ rake (>= 0.8.7)
+ rubyforge (>= 1.0.4)
+ jruby-openssl (0.7.7)
+ bouncy-castle-java (>= 1.5.0146.1)
+ json_pure (1.4.3)
+ minitar (0.5.3)
+ net-sftp (2.0.5)
+ net-ssh (>= 2.0.9)
+ net-ssh (2.3.0)
+ rake (0.9.2.2)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
+ rubyforge (2.0.3)
+ json_pure (>= 1.1.7)
+ rubyzip (0.9.4)
+ xml-simple (1.0.12)
+
+PLATFORMS
+ java
+
+DEPENDENCIES
+ buildr (= 1.4.7)
View
@@ -17,12 +17,15 @@
t.string(:Name, 255)
end
+ data_module.enumeration(:UserType, :integer, :values => {"STAFF" => 0 ,"ADMIN" => 1})
+
data_module.entity(:User) do |t|
t.integer(:ID, :primary_key => true)
t.string(:Login, 255)
t.string(:Name, 255)
t.string(:Email, 255)
t.string(:Password, 255)
+ t.enumeration(:UserType, :UserType)
t.unique_constraint([:Login])
t.unique_constraint([:Name])
end
@@ -32,6 +35,7 @@
s.text(:Login)
s.text(:Name)
s.text(:Email)
+ s.enumeration(:UserType, :UserType)
end
data_module.entity(:Project) do |t|
@@ -55,6 +59,7 @@
m.string(:Name, 255)
m.string(:Password, 255)
m.string(:Email, 255)
+ m.enumeration(:UserType, :UserType)
m.returns(:struct, :referenced_struct => :UserDTO)
end
@@ -67,6 +72,7 @@
m.string(:Login, 255)
m.string(:Name, 255)
m.string(:Email, 255)
+ m.enumeration(:UserType, :UserType)
m.returns(:struct, :referenced_struct => :UserDTO)
end
View
@@ -4,7 +4,7 @@ gems:
repositories:
remote:
- http://repo.fire.dse.vic.gov.au/content/groups/fisg
- - http://repo1.maven.org/
+ - http://repo1.maven.org/maven2
release_to:
url: http://repo.fire.dse.vic.gov.au/content/repositories/releases/
username: upload
@@ -24,6 +24,7 @@ artifacts:
javax_persistence: org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final
javax_transaction: javax.transaction:jta:jar:1.1
javax_annotation: com.google.code.findbugs:jsr305:jar:1.3.9
+ javax_security_annotations: org.apache.tomcat:annotations-api:jar:6.0.35
javax_interceptor: org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final
javax_jaxrpc: org.apache.geronimo.specs:geronimo-jaxrpc_1.1_spec:jar:2.1
View
@@ -17,12 +17,11 @@ define('tide', :layout => layout) do
:javax_servlet,
:javax_validation,
:javax_annotation,
+ :javax_security_annotations,
:jackson_core,
:jackson_mapper,
:gxt,
:gxt_uibinder,
- :javax_annotation,
- :gwt_user,
:google_guice,
:aopalliance,
:google_guice_assistedinject,
@@ -36,7 +35,7 @@ define('tide', :layout => layout) do
test.with :mockito, :guiceyloops, :eclipselink, :jtds
test.using :testng
- tide_module = gwt(["au.com.stocksoftware.tide.Tide"],
+ tide_module = gwt(["au.com.stocksoftware.tide.TideDev"],
:dependencies => [project.compile.dependencies,
project.compile.target,
:gxt,
@@ -65,12 +64,15 @@ define('tide', :layout => layout) do
iml.add_ejb_facet
iml.add_web_facet
- ipr.add_exploded_war_artifact(project,
- :dependencies => [project, :gwt_user],
+end
+
+Buildr.project('tide').ipr.add_exploded_war_artifact(project('tide'),
+ :name => 'tide',
+ :dependencies => [project('tide'), :gwt_user],
:enable_gwt => true,
:enable_ejb => true,
:enable_jpa => true)
-end
+
define_dbt_tasks(Buildr.project('tide'))
@@ -20,6 +20,7 @@
@Inject
private UserService _userService;
+
private UserVO _currentUser;
private boolean _newUser;
@@ -78,6 +79,7 @@ public void actionSave()
if ( null != _currentUser )
{
_userService.updateUser( _currentUser.getId(), newValues.getLogin(), newValues.getName(), newValues.getEmail(),
+ newValues.getUserType(),
new AsyncCallback<UserDTO>()
{
@Override
@@ -92,6 +94,7 @@ public void onSuccess( final UserDTO updatedUser )
else if ( _newUser )
{
_userService.addUser( newValues.getLogin(), newValues.getName(), "password", newValues.getEmail(),
+ newValues.getUserType(),
new AsyncCallback<UserDTO>()
{
@Override
@@ -1,5 +1,6 @@
package au.com.stocksoftware.tide.client.entity;
+import au.com.stocksoftware.tide.client.data_type.core.UserType;
import java.util.List;
import javax.annotation.Nonnull;
@@ -9,16 +10,19 @@
private String _login;
private String _name;
private String _email;
+ private UserType _userType;
public UserVO( final int id,
@Nonnull final String login,
@Nonnull final String name,
- @Nonnull final String email )
+ @Nonnull final String email,
+ @Nonnull final UserType userType )
{
_id = id;
_login = login;
_name = name;
_email = email;
+ _userType = userType;
}
public int getId()
@@ -40,4 +44,9 @@ public String getLogin()
{
return _login;
}
+
+ public UserType getUserType()
+ {
+ return _userType;
+ }
}
@@ -28,7 +28,8 @@ public static UserVO userDTOToVO( final UserDTO dto )
return new UserVO( dto.getID(),
dto.getLogin(),
dto.getName(),
- dto.getEmail() );
+ dto.getEmail(),
+ dto.getUserType());
}
public static List<ProjectVO> projectDTOsToVOs( final List<ProjectDTO> dtos )
@@ -1,6 +1,7 @@
package au.com.stocksoftware.tide.client.view.ui;
import au.com.stocksoftware.tide.client.activity.AdminUsersPresenter;
+import au.com.stocksoftware.tide.client.data_type.core.UserType;
import au.com.stocksoftware.tide.client.entity.UserVO;
import au.com.stocksoftware.tide.client.view.AdminUsersView;
import com.google.gwt.core.client.GWT;
@@ -15,6 +16,7 @@
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.ValueProvider;
+import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
@@ -23,6 +25,7 @@
import com.sencha.gxt.widget.core.client.ListView;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
+import com.sencha.gxt.widget.core.client.form.ComboBox;
import com.sencha.gxt.widget.core.client.form.TextField;
import java.util.List;
@@ -64,6 +67,9 @@
@UiField
ContentPanel _userContentPanel;
+
+ @UiField
+ ComboBox<UserType> _type;
Presenter _presenter;
@@ -103,7 +109,7 @@ public void setPresenter( final AdminUsersPresenter presenter )
@Override
public void showAddUser()
{
- _userList.getSelectionModel().deselectAll( );
+ _userList.getSelectionModel().deselectAll();
updateValues( null );
enableFields( true );
_userLogin.focus();
@@ -132,13 +138,14 @@ public void clearCurrentUser()
updateValues( null );
enableFields( false );
configureButtons( false, false, false, false, false );
- _userList.getSelectionModel().deselectAll( );
+ _userList.getSelectionModel().deselectAll();
}
@Override
public UserVO getCurrentValues()
{
- return new UserVO( -1, _userLogin.getCurrentValue(), _userName.getCurrentValue(), _userEmail.getCurrentValue() );
+ return new UserVO( -1, _userLogin.getCurrentValue(), _userName.getCurrentValue(), _userEmail.getCurrentValue(),
+ UserType.STAFF );
}
@Override
@@ -155,7 +162,8 @@ ListView createListView()
final ListView<UserVO, String> list = new ListView<UserVO, String>(
new ListStore<UserVO>( userProperties.key() ), userProperties.name() );
- list.getSelectionModel().addSelectionHandler( new SelectionHandler<UserVO>() {
+ list.getSelectionModel().addSelectionHandler( new SelectionHandler<UserVO>()
+ {
@Override
public void onSelection( final SelectionEvent<UserVO> userVOSelectionEvent )
{
@@ -166,6 +174,16 @@ public void onSelection( final SelectionEvent<UserVO> userVOSelectionEvent )
return list;
}
+ @UiFactory
+ ComboBox<UserType> createUserTypeCombo()
+ {
+ final UserTypeProperties props = GWT.create( UserTypeProperties.class );
+
+ final ListStore<UserType> store = new ListStore<UserType>(props.key());
+
+ return new ComboBox<UserType>(store, props.name());
+ }
+
interface UserProperties
extends PropertyAccess<UserVO>
{
@@ -176,6 +194,16 @@ public void onSelection( final SelectionEvent<UserVO> userVOSelectionEvent )
ValueProvider<UserVO, String> name();
}
+ interface UserTypeProperties
+ extends PropertyAccess<UserType>
+ {
+ @Path( "ordinal" )
+ ModelKeyProvider<UserType> key();
+
+ @Path( "name" )
+ LabelProvider<UserType> name();
+ }
+
@UiHandler( { "_addButton" } )
public void onAddUserClicked( final SelectEvent event )
{
@@ -40,10 +40,17 @@
</container:west>
<container:center>
<g:VerticalPanel spacing="10">
- <c:ContentPanel width="280" height="120" headerVisible="false" borders="false" bodyBorder="false"
+ <c:ContentPanel width="280" height="160" headerVisible="false" borders="false" bodyBorder="false"
bodyStyle="background: none; padding: 5px" ui:field="_userContentPanel">
<container:VerticalLayoutContainer>
<container:child layoutData="{verticalLayoutData}">
+ <form:FieldLabel text="User Type">
+ <form:widget>
+ <form:ComboBox ui:field="_type" allowBlank="true" forceSelection="true" triggerAction="ALL"/>
+ </form:widget>
+ </form:FieldLabel>
+ </container:child>
+ <container:child layoutData="{verticalLayoutData}">
<form:FieldLabel text="Login">
<form:widget>
<form:TextField ui:field="_userLogin"/>
Oops, something went wrong.

0 comments on commit 8c99193

Please sign in to comment.