Skip to content

Commit

Permalink
if not user model retutn UNAUTHORIZED
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreampie committed Jan 27, 2016
1 parent 061bd9a commit 21b63af
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


import cn.dreampie.common.entity.Entity;
import cn.dreampie.common.http.exception.WebException;
import cn.dreampie.common.http.result.HttpStatus;

import java.io.Serializable;
import java.util.Set;
Expand Down Expand Up @@ -51,6 +53,10 @@ public boolean hasCredential(String permission) {
}

public M getModel() {
return model;
if (model == null) {
throw new WebException(HttpStatus.UNAUTHORIZED, "Could not found any user for this session.");
} else {
return model;
}
}
}

0 comments on commit 21b63af

Please sign in to comment.