misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
9.94k stars 1.35k forks source link

First user did not receive admin rights #8685

Open belatedly opened 2 years ago

belatedly commented 2 years ago

💡 Summary

I am moving my instance from one VPS to another on a different service. I did a fresh install on the new VPS and created the first account. It did not receive admin rights and it is the only user showing. Can someone advise how I can set the account as admin in the command line?

🥰 Expected Behavior

First account should become admin.

🤬 Actual Behavior

First account is just a regular account.

📝 Steps to Reproduce

  1. Point domain at new IP
  2. Install Misskey
  3. Register first user

📌 Environment

Misskey version: 12.110.1 Your OS: Debian 10 Your browser: Safari and Firefox

Johann150 commented 2 years ago

You can manually mark a user as admin by issuing this SQL query:

UPDATE "user" SET "isAdmin" = TRUE WHERE "id" = '<id>';

Replace <id> with the ID of the user (leave the single quotes). You can find the ID of a user by going to their profile page, click the three dots next to the follow button and select the "About" menu entry.

Johann150 commented 2 years ago

Are you absolutely sure that there is no other account? You can check by running

SELECT COUNT(1) FROM "user" WHERE "host" IS NULL;
belatedly commented 2 years ago

Thank you! The instance.actor account is there in addition to the one I created but I wouldn't think it gave that one admin. I will check once the domain propagates back to the new VPS.

Johann150 commented 2 years ago

It might be a race condition if the instance.actor account is created first. The auto-admin part checks the total local user count so if any of the system users gets created first, this might be an issue. https://github.com/misskey-dev/misskey/blob/1c67c26bd87aae64fe0f2ef45140e12a78564699/packages/backend/src/server/api/common/signup.ts#L88-L90 Since system accounts will always be created as a non-admin user (see below) adding isAdmin: true as a condition to the above could resolve this problem. https://github.com/misskey-dev/misskey/blob/1c67c26bd87aae64fe0f2ef45140e12a78564699/packages/backend/src/services/create-system-user.ts#L43

belatedly commented 2 years ago

It just propagated, the instance.actor account is not set as admin either. I am guessing the lack of admin has something to do with the instance having already been established and running for nearly 2 years - even though it had propagated on my machine maybe it was still floating between the two IPs when the install was completed.

tamaina commented 1 year ago

これ修正したんだっけ

binary3141 commented 1 year ago

same problem in v13 installed by docker UPDATE "user" SET "isAdmin" = TRUE WHERE "id" = ''; showed : ERROR: column "isAdmin" of relation "user" does not exist

DarkShyMW commented 1 year ago

same problem in v13 installed by docker UPDATE "user" SET "isAdmin" = TRUE WHERE "id" = ''; showed : ERROR: column "isAdmin" of relation "user" does not exist

same trouble

melerva commented 11 months ago

I did some digging. The new command is:

UPDATE public.user SET "isRoot" = TRUE WHERE "id" = '<id>';

After that, reboot to let everything settle.