GitLab wurde erfolgreich aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Danke für Ihre Geduld.

Commit 20734e6b authored by Andreas Gärtner's avatar Andreas Gärtner

Added authToken to User and a query to get a user by authToken.

parent 04bf330c
...@@ -15,10 +15,16 @@ public class User { ...@@ -15,10 +15,16 @@ public class User {
@Unique @Unique
@Column(name = "user_id") @Column(name = "user_id")
private String userId; private String userId;
@Column(name = "password") @Column(name = "password")
private String password; private String password;
@Column(name = "is_admin") @Column(name = "is_admin")
private boolean isAdmin; private boolean isAdmin;
@Unique
@Column(name = "auth_token")
private String authToken;
public String getUserId() { public String getUserId() {
return userId; return userId;
...@@ -40,6 +46,14 @@ public class User { ...@@ -40,6 +46,14 @@ public class User {
public void setAdmin(boolean isAdmin) { public void setAdmin(boolean isAdmin) {
this.isAdmin = isAdmin; this.isAdmin = isAdmin;
} }
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public String getAuthToken() {
return authToken;
}
@Override @Override
public int hashCode() { public int hashCode() {
......
package de.thm.arsnova.connector.persistence.repository; package de.thm.arsnova.connector.persistence.repository;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import de.thm.arsnova.connector.persistence.domain.User; import de.thm.arsnova.connector.persistence.domain.User;
@Repository @Repository
public interface UserRepository extends JpaRepository<User, String> { public interface UserRepository extends JpaRepository<User, String> {
@Query("select u from User u where u.authToken like %?1")
User findByToken(String authToken);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment