fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

How to specify admin in config.json with "security_type": "friends" #167

Closed rybesh closed 1 year ago

rybesh commented 2 years ago

I am running a local fedwiki with "security_type": "friends" in my config.json.

I would like to make myself admin so that I can install plugins. How do I do that? “The admin value would depend on how individuals are identified by the security module in use,” but no example is given for "security_type": "friends".

WardCunningham commented 2 years ago

There is a code generated and stored in owner.json, or sometimes specified in config and stored elsewhere, that is the code you want to specify as the identity of the single administrator.

WardCunningham commented 2 years ago

I would like to add the example that is missing. Where were you looking? I tried: https://github.com/fedwiki/wiki-security-friends

We have made good documentation difficult by offering many options to a site operator. There is a docker image floating around that configures owners in a somewhat unusual way. By chance are you using that image?

rybesh commented 2 years ago

I was looking at http://fedwiki.org/view/admin-user

I'm not using a docker image.

Here's my setup:

$ cat ~/.wiki/config.json
{
  "security_type": "friends",
  "cookieSecret": "[REDACTED COOKIE SECRET]",
  "session_duration": 365
}
$ cat ~/.wiki/status/owner.json
{
  "name": "Ryan Shaw",
  "friend": {
    "secret": "[REDACTED SECRET]"
  }
}

The example at http://fedwiki.org/view/admin-user says to add to config.json the following:

"admin": {"google": "1234xxxxxxxxxx"},

I'm unclear whether the friends equivalent would be:

"admin": "[REDACTED SECRET]",

or

"admin": {"secret": "[REDACTED SECRET]"},

or

"admin": {"friend": {"secret": "[REDACTED SECRET]"}},

or

"admin": {"friends": {"secret": "[REDACTED SECRET]"}},

or some other variation I haven't thought of yet.

Part of the problem may be that I don't know how to test whether I am successfully logging in as an admin.

WardCunningham commented 2 years ago

I regret that I am unsure of the answer because I am not sure what path this information takes through the code. I believe you want the config file equivalent of the command line parameter --admin 098034982034

I will consult other developers to see if I can come up with a more definitive answer and make sure it is well documented. Many of our user/administrators write about what has worked for them and that is the case for the page you cite. It is also the case for me above because I just looked at the one site I have that uses friends without a full understanding of what is possible.

WardCunningham commented 2 years ago

We should be able to do better than this.

WardCunningham commented 2 years ago

I have determined experimentally that the correct config format would be:

"admin": "[REDACTED SECRET]",