Skip to content

Commit

Permalink
looks like migration stuck on play-authenticate joscha/play-authentic…
Browse files Browse the repository at this point in the history
  • Loading branch information
alunev committed Jun 7, 2018
1 parent 7e37547 commit 66cf4ed
Show file tree
Hide file tree
Showing 29 changed files with 288 additions and 193 deletions.
2 changes: 1 addition & 1 deletion web/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions web/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions web/.idea/play2_project_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions web/.idea/play2_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/.idea/sbt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions web/app/Filters.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

import filters.ExampleFilter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
* This class configures filters that run on every request. This
* class is queried by Play to get a list of filters.
Expand All @@ -32,15 +36,15 @@ public Filters(Environment env, ExampleFilter exampleFilter) {
}

@Override
public EssentialFilter[] filters() {
// Use the example filter if we're running development mode. If
// we're running in production or test mode then don't use any
// filters at all.
if (env.mode().equals(Mode.DEV)) {
return new EssentialFilter[] { exampleFilter };
} else {
return new EssentialFilter[] {};
}
public List<EssentialFilter> getFilters() {
// Use the example filter if we're running development mode. If
// we're running in production or test mode then don't use any
// filters at all.
if (env.mode().equals(Mode.DEV)) {
return Collections.singletonList(exampleFilter);
} else {
return Collections.emptyList();
}
}

}
8 changes: 6 additions & 2 deletions web/app/auth/basic/AlwaysValidBasicAuthProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import play.inject.ApplicationLifecycle;
import play.mvc.Http.Context;
import play.twirl.api.Content;
import views.html.login;

import javax.inject.Inject;
import javax.inject.Singleton;
Expand All @@ -33,9 +32,14 @@
@Singleton
public class AlwaysValidBasicAuthProvider extends BasicAuthProvider {

private final views.html.login login;

@Inject
public AlwaysValidBasicAuthProvider(final PlayAuthenticate auth, final ApplicationLifecycle lifecycle) {
public AlwaysValidBasicAuthProvider(final PlayAuthenticate auth,
final ApplicationLifecycle lifecycle,
views.html.login login) {
super(auth, lifecycle);
this.login = login;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion web/app/auth/deadbolt/FmPlayAuthDeadboltHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public FmPlayAuthDeadboltHandler(final PlayAuthenticate auth,
}

@Override
public CompletionStage<Optional<Result>> beforeAuthCheck(final Http.Context context) {
public CompletionStage<Optional<Result>> beforeAuthCheck(final Http.Context context, Optional<String> content) {
if (this.auth.isLoggedIn(context.session())) {
// user is logged in
return CompletableFuture.completedFuture(Optional.empty());
Expand Down
18 changes: 14 additions & 4 deletions web/app/controllers/AccountsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import play.mvc.Controller;
import play.mvc.Result;
import services.UserService;
import views.html.accounts;
import views.html.edit_account;

public class AccountsController extends Controller {

Expand All @@ -24,16 +22,28 @@ public class AccountsController extends Controller {
private final FormFactory formFactory;

private final AccountDao accountDao;

private final UserDao userDao;

private final views.html.accounts accounts;

private final views.html.edit_account edit_account;

@Inject
public AccountsController(PlayAuthenticate auth, UserService userService, FormFactory formFactory,
AccountDao accountDao, UserDao userDao) {
public AccountsController(PlayAuthenticate auth,
UserService userService,
FormFactory formFactory,
AccountDao accountDao,
UserDao userDao,
views.html.accounts accounts,
views.html.edit_account edit_account) {
this.auth = auth;
this.userService = userService;
this.formFactory = formFactory;
this.accountDao = accountDao;
this.userDao = userDao;
this.accounts = accounts;
this.edit_account = edit_account;
}

public Result accounts() {
Expand Down
12 changes: 0 additions & 12 deletions web/app/controllers/AsyncController.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;

/**
* This controller contains an action that demonstrates how to write
* simple asynchronous code in a controller. It uses a timer to
* asynchronously delay sending a response for 1 second.
*
* @param actorSystem We need the {@link ActorSystem}'s
* {@link Scheduler} to run code after a delay.
* @param exec We need a Java {@link Executor} to apply the result
* of the {@link CompletableFuture} and a Scala
* {@link ExecutionContext} so we can use the Akka {@link Scheduler}.
* An {@link ExecutionContextExecutor} implements both interfaces.
*/
@Singleton
public class AsyncController extends Controller {

Expand Down
13 changes: 10 additions & 3 deletions web/app/controllers/HomeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import play.mvc.Controller;
import play.mvc.Result;
import services.UserService;
import views.html.index;
import views.html.logon_failed;

/**
* This controller contains an action to handle HTTP requests
Expand All @@ -19,10 +17,19 @@ public class HomeController extends Controller {

private final UserService userService;

private final views.html.logon_failed logon_failed;

private final views.html.index index;

@Inject
public HomeController(PlayAuthenticate auth, UserService userService) {
public HomeController(PlayAuthenticate auth,
UserService userService,
views.html.logon_failed logon_failed,
views.html.index index) {
this.auth = auth;
this.userService = userService;
this.logon_failed = logon_failed;
this.index = index;
}

public Result oAuthDenied(String provider, String errorMessage) {
Expand Down
39 changes: 39 additions & 0 deletions web/app/controllers/SmsHistoryController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package controllers;

import com.feth.play.module.pa.PlayAuthenticate;
import com.google.inject.Inject;
import dao.SmsDao;
import model.User;
import play.mvc.Controller;
import play.mvc.Result;
import services.UserService;

public class SmsHistoryController extends Controller {

private final PlayAuthenticate auth;

private final UserService userService;

private final SmsDao smsDao;

private final views.html.sms_history sms_history;

@Inject
public SmsHistoryController(PlayAuthenticate auth,
UserService userService,
SmsDao smsDao,
views.html.sms_history sms_history) {
this.auth = auth;
this.userService = userService;
this.smsDao = smsDao;
this.sms_history = sms_history;
}

public Result list() {
User user = userService.getUser(session());

return ok(sms_history.render(auth, user, smsDao.findByOwnerId(user.getId())));
}


}
20 changes: 15 additions & 5 deletions web/app/controllers/TransactionsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import play.mvc.Controller;
import play.mvc.Result;
import services.UserService;
import views.html.edit_transaction;
import views.html.transactions;

import java.util.Map;
import java.util.UUID;
Expand All @@ -40,17 +38,29 @@ public class TransactionsController extends Controller {

private final FormFactory formFactory;

private final views.html.transactions transactions;

private final views.html.edit_transaction edit_transaction;

@Inject
public TransactionsController(PlayAuthenticate auth, UserService userService, TransactionDao transactionDao,
TransactionCategoryDao transactionCategoryDao, UserDao userDao, AccountDao accountDao,
FormFactory formFactory) {
public TransactionsController(PlayAuthenticate auth,
UserService userService,
TransactionDao transactionDao,
TransactionCategoryDao transactionCategoryDao,
UserDao userDao,
AccountDao accountDao,
FormFactory formFactory,
views.html.transactions transactions,
views.html.edit_transaction edit_transaction) {
this.auth = auth;
this.userService = userService;
this.transactionDao = transactionDao;
this.transactionCategoryDao = transactionCategoryDao;
this.userDao = userDao;
this.accountDao = accountDao;
this.formFactory = formFactory;
this.transactions = transactions;
this.edit_transaction = edit_transaction;
}

public Result transactions() {
Expand Down
2 changes: 1 addition & 1 deletion web/app/core/message/matcher/RegexAccountMatcher.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package core.message.matcher;

import com.google.inject.Inject;
import dao.AccountDao;
import model.Account;

import javax.inject.Inject;
import java.util.Optional;

/**
Expand Down
12 changes: 12 additions & 0 deletions web/app/dao/SmsDao.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package dao;

import com.google.common.collect.Sets;
import com.google.inject.Inject;
import model.Sms;
import org.bson.types.ObjectId;
import org.jongo.MongoCursor;
import uk.co.panaxiom.playjongo.PlayJongo;

import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;


public class SmsDao {
private PlayJongo playJongo;
Expand All @@ -18,6 +24,12 @@ public Sms findById(String id) {
return smses().findOne("{_id: #}", new ObjectId(id)).as(Sms.class);
}

public Set<Sms> findByOwnerId(String userId) {
MongoCursor<Sms> mongoCursor = smses().find("{ownerId: #}", userId).as(Sms.class);

return new HashSet<>(Sets.newHashSet(mongoCursor.iterator()));
}

public Sms save(Sms sms) {
smses().save(sms);

Expand Down
3 changes: 2 additions & 1 deletion web/app/model/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import lombok.Builder;
import org.jongo.marshall.jackson.oid.MongoObjectId;

Expand Down Expand Up @@ -289,7 +290,7 @@ public int hashCode() {

@Override
public String toString() {
return com.google.common.base.Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("_id", _id)
.add("ownerId", ownerId)
.add("transactionType", transactionType)
Expand Down
Loading

0 comments on commit 66cf4ed

Please sign in to comment.