-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
| DATABASE_ADDRESS | | | `127.0.0.1` | | ||
| DATABASE_NAME | | | `faf` | | ||
| DATABASE_PASSWORD | | | `banana` | | ||
| DATABASE_SCHEMA_VERSION | `123` | | | | ||
| DATABASE_SCHEMA_VERSION | `124` | | | | ||
| DATABASE_USERNAME | | | `faf-java-api` | | ||
| EMAIL_FROM_ADDRESS | | | `[email protected]` | | ||
| EMAIL_FROM_NAME | | | `FAForever` | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/com/faforever/api/data/domain/CoturnServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.faforever.api.data.domain; | ||
|
||
import com.faforever.api.data.checks.Prefab; | ||
import com.faforever.api.security.elide.permission.LobbyCheck; | ||
import com.yahoo.elide.annotation.Include; | ||
import com.yahoo.elide.annotation.ReadPermission; | ||
import com.yahoo.elide.annotation.UpdatePermission; | ||
import lombok.Setter; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "coturn_servers") | ||
@Include(name = CoturnServer.TYPE_NAME) | ||
@ReadPermission(expression = LobbyCheck.EXPRESSION) | ||
@UpdatePermission(expression = Prefab.NONE) | ||
@Setter | ||
public class CoturnServer { | ||
public static final String TYPE_NAME = "coturnServer"; | ||
|
||
private Integer id; | ||
private String region; | ||
private String host; | ||
private Integer port; | ||
private String key; | ||
private boolean active; | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
@Column(name = "region") | ||
public String getRegion() { | ||
return region; | ||
} | ||
|
||
@Column(name = "host") | ||
public String getHost() { | ||
return host; | ||
} | ||
|
||
@Column(name = "port") | ||
public Integer getPort() { | ||
return port; | ||
} | ||
|
||
@Column(name = "preshared_key") | ||
public String getKey() { | ||
return key; | ||
} | ||
|
||
@Column(name = "active") | ||
public boolean isActive() { | ||
return active; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/faforever/api/security/elide/permission/LobbyCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.faforever.api.security.elide.permission; | ||
|
||
import com.faforever.api.security.OAuthScope; | ||
import com.yahoo.elide.annotation.SecurityCheck; | ||
import com.yahoo.elide.core.security.User; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import static com.faforever.api.security.elide.permission.LobbyCheck.EXPRESSION; | ||
|
||
@Slf4j | ||
@SecurityCheck(EXPRESSION) | ||
public class LobbyCheck extends FafUserCheck { | ||
public static final String EXPRESSION = "Lobby"; | ||
|
||
@Override | ||
public boolean ok(User user) { | ||
return checkOAuthScopes(OAuthScope.LOBBY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters