Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. "Read more...":https://support.plan.io/news/187

Feature #766520

closed

Add fcdb hook for checking if player delegation is allowed

Added by Zoltán Žarkov over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Server
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Longturn.org and fcweb both could use this.


Files

fcdb-delegate.patch (2.63 KB) fcdb-delegate.patch master Zoltán Žarkov, 2018-07-24 05:42 PM
0002-Add-fcdb-calls-for-checking-if-take-and-delegate-to-.patch (8.47 KB) 0002-Add-fcdb-calls-for-checking-if-take-and-delegate-to-.patch master Zoltán Žarkov, 2018-09-30 06:56 AM
0002-Add-fcdb-calls-for-checking-if-take-and-delegate-to-.patch (3.77 KB) 0002-Add-fcdb-calls-for-checking-if-take-and-delegate-to-.patch master Zoltán Žarkov, 2018-09-30 04:56 PM
0002-Add-fcdb-checks-to-delegate-and-take.patch (11 KB) 0002-Add-fcdb-checks-to-delegate-and-take.patch master Zoltán Žarkov, 2018-09-30 06:46 PM
0001-Add-fcdb-checks-to-delegate-and-take.patch (11 KB) 0001-Add-fcdb-checks-to-delegate-and-take.patch Zoltán Žarkov, 2018-10-05 08:50 PM
0001-Add-fcdb-check-to-delegate-to-subcommand.patch (9.01 KB) 0001-Add-fcdb-check-to-delegate-to-subcommand.patch master Zoltán Žarkov, 2018-10-06 12:28 AM
0001-Add-fcdb-check-to-delegate-to-subcommand.patch (9.04 KB) 0001-Add-fcdb-check-to-delegate-to-subcommand.patch Zoltán Žarkov, 2018-10-06 01:15 AM
0005-Add-fcdb-check-to-delegate-to-subcommand.patch (9.01 KB) 0005-Add-fcdb-check-to-delegate-to-subcommand.patch S3_0 Zoltán Žarkov, 2018-10-06 02:32 AM
0005-Add-fcdb-check-to-delegate-to-subcommand.patch (9.04 KB) 0005-Add-fcdb-check-to-delegate-to-subcommand.patch S3_0 Zoltán Žarkov, 2018-10-06 03:11 AM
0001-Add-fcdb-check-to-delegate-to-subcommand.patch (9.17 KB) 0001-Add-fcdb-check-to-delegate-to-subcommand.patch master Zoltán Žarkov, 2018-10-18 03:50 AM
0002-Add-fcdb-check-to-delegate-to-subcommand.patch (9.17 KB) 0002-Add-fcdb-check-to-delegate-to-subcommand.patch S3_0 Zoltán Žarkov, 2018-10-18 03:50 AM
0002-Add-fcdb-check-to-delegate-to-subcommand.patch (9.64 KB) 0002-Add-fcdb-check-to-delegate-to-subcommand.patch S3_0 Zoltán Žarkov, 2018-10-18 05:24 AM
0001-Add-fcdb-check-to-delegate-to-subcommand.patch (9.64 KB) 0001-Add-fcdb-check-to-delegate-to-subcommand.patch master Zoltán Žarkov, 2018-10-18 05:24 AM

Related issues

Related to Freeciv - Feature #657143: fcdb: allow database.lua to set user's cmdlevel, delegation etcClosedMarko Lindqvist

Actions
Related to Freeciv - Task #656466: S3_0 datafile format freeze (d3f)ClosedMarko Lindqvist2019-10-05

Actions
Blocked by Freeciv - Feature #769078: Change call signature for luascript funcs to allow any return valuesClosedMarko Lindqvist

Actions
Actions #1

Updated by Jacob Nevins over 4 years ago

  • Related to Feature #657143: fcdb: allow database.lua to set user's cmdlevel, delegation etc added
Actions #2

Updated by Jacob Nevins over 4 years ago

Previous vague thoughts on the topic in feature #657143.

Actions #3

Updated by Marko Lindqvist over 4 years ago

The code is being added for "/take" and not for "/delegate take" command. Why is that?

Actions #4

Updated by Zoltán Žarkov over 4 years ago

On lt.org you set delegations from the web site, so the freeciv server just needs logic to handle /take. I think there are a lot more fcdb script calls to be added like getting userlevel, so I will make a more extensive patch.

Actions #5

Updated by Zoltán Žarkov over 4 years ago

  • Related to Task #656466: S3_0 datafile format freeze (d3f) added
Actions #6

Updated by Zoltán Žarkov over 4 years ago

I think anything that changes the behavior of database.lua counts as datafile breaking, and I'm changing the return API for some things in there.

Actions #7

Updated by Zoltán Žarkov over 4 years ago

  • Blocked by Feature #769078: Change call signature for luascript funcs to allow any return values added
Actions #8

Updated by Zoltán Žarkov over 4 years ago

Background- fcweb game 0x10 is a 2-team 23h turn game where each team has a captain that is allowed to do /delegate to for any of their teammates in the case of unexpected idleness. Additionally, all players may /observe any of their teammates but no other players. These are the changes to enable these sorts of behaviors in fcdb lua scripts.

  • Add fcdb functions to check if /delegate to and /take are allowed.
  • Add lua environment function for checking connection's player
  • Add lua environment function for checking player's team.
Actions #12

Updated by Marko Lindqvist over 4 years ago

Zoltán Žarkov wrote:

On lt.org you set delegations from the web site, so the freeciv server just needs logic to handle /take. I think there are a lot more fcdb script calls to be added like getting userlevel, so I will make a more extensive patch.

Regardless where the delegation is first set, shouldn't this be "take" subcommand of "/delegate" and not completely separate command of "/take"? Even if it's ok for lt use-case, it doesn't seem like a right to do in our (upstream) code. There's a difference between "/take" and "/delegate take" and we don't want to lose ability to do "/take" semantics by making it behave like "/delegate take". Or have I misunderstood something completely?

Actions #13

Updated by Zoltán Žarkov over 4 years ago

This is really two new behaviors that could be split into two tickets if you'd like:
  • "delegate to" calls a lua function user_delegate_to to check permission if its a connection other than the assigned user or console.
  • "take" and "observe" commands call lua user_take through is_allowed_to_take
Actions #15

Updated by Marko Lindqvist over 4 years ago

script_fcdb_call("user_delegate_to", caller, dplayer, &ret) seems to be missing API_TYPE_STRING (password?) parameter defined for "user_delegate_to" in script_fcdb.c.

Actions #17

Updated by Marko Lindqvist over 4 years ago

  • Status changed from New to Resolved
  • Sprint/Milestone set to 3.0.0
Actions #20

Updated by Marko Lindqvist over 4 years ago

  • Category set to Server
  • Assignee changed from Zoltán Žarkov to Marko Lindqvist
Actions #21

Updated by Marko Lindqvist over 4 years ago

So database.lua does not implement user_delegate_to, but we rely on behavior being correct in complete lack of the function. I think I would prefer trivial user_delegate_to implementation to provide "no special permission", but that can wait to a new ticket (assuming current implementation does the right thing)

Actions #22

Updated by Marko Lindqvist over 4 years ago

Have you successfully tested all of these cases:
- Permission is not granted when fcdb support is not built in at all (not built in by default in S3_0)
- Permission is not granted when "user_delegate_to" does not grant it
- Permission is granted when "user_delegate_to" grants it

I'm failing to get "user_delegate_to" to ever grant permissions, but there might be something wrong in my setup.

Actions #23

Updated by Marko Lindqvist over 4 years ago

Just noticed that I had got:
1: in luascript_func_call_valist() [../../../../src/common/scriptcore/luascript_func.c::206]: assertion 'fcl' failed.

This is when I have fcdb support built in (so it really tries to call user_delegate_to when I request delegation) but not set player auth to use runtime.

Actions #24

Updated by Marko Lindqvist over 4 years ago

You probably need to check srvarg.fcdb_enabled before calling script_fcdb_call()

Actions #25

Updated by Marko Lindqvist over 4 years ago

  • Status changed from Resolved to In Progress
Actions #26

Updated by Marko Lindqvist over 4 years ago

  • Assignee changed from Marko Lindqvist to Zoltán Žarkov
Actions #28

Updated by Marko Lindqvist over 4 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Zoltán Žarkov to Marko Lindqvist
Actions #30

Updated by Marko Lindqvist over 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF