Skip to content

Commit

Permalink
Added "login" permission checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Beisley committed Jul 17, 2011
1 parent c3f6575 commit 09824fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion groups.json
Expand Up @@ -2,7 +2,6 @@
"default": {
"default":true,
"permissions": [
"login",
"user.commands.help",
"user.commands.kill",
"user.commands.me",
Expand Down
9 changes: 9 additions & 0 deletions src/chunkymonkey/game.go
Expand Up @@ -11,6 +11,7 @@ import (
"time"

. "chunkymonkey/entity"
"chunkymonkey/gamerules"
"chunkymonkey/player"
"chunkymonkey/proto"
"chunkymonkey/server_auth"
Expand Down Expand Up @@ -99,6 +100,14 @@ func (game *Game) login(conn net.Conn) {
return
}

// Load player permissions.
permissions := gamerules.Permissions.UserPermissions(username)
if !permissions.Has("login") {
err = fmt.Errorf("Player %q does not have login permission", username)
clientErr = os.NewError("You do not have access to this server.")
return
}

if err = proto.ServerWriteHandshake(conn, game.serverId); err != nil {
clientErr = os.NewError("Handshake error.")
return
Expand Down

0 comments on commit 09824fd

Please sign in to comment.