[SECURITY] New actors are Person user on register by default

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-18 04:24:27 +00:00
parent 630e22579e
commit a9feb79825
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,7 @@ use App\Core\Event;
use App\Core\Form; use App\Core\Form;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Core\Log; use App\Core\Log;
use App\Core\UserRoles;
use App\Entity\Actor; use App\Entity\Actor;
use App\Entity\Feed; use App\Entity\Feed;
use App\Entity\LocalUser; use App\Entity\LocalUser;
@ -146,7 +147,12 @@ class Security extends Controller
try { try {
// This already checks if the nickname is being used // This already checks if the nickname is being used
$actor = Actor::create(['nickname' => $nickname, 'is_local' => true]); $actor = Actor::create([
'nickname' => $nickname,
'is_local' => true,
'type' => Actor::PERSON,
'roles' => UserRoles::USER,
]);
$user = LocalUser::create([ $user = LocalUser::create([
'nickname' => $nickname, 'nickname' => $nickname,
'outgoing_email' => $data['email'], 'outgoing_email' => $data['email'],

View File

@ -536,7 +536,7 @@ class Actor extends Entity
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'], 'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'], 'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'],
'fullname' => ['type' => 'text', 'description' => 'display name'], 'fullname' => ['type' => 'text', 'description' => 'display name'],
'roles' => ['type' => 'int', 'not null' => true, 'default' => UserRoles::USER, 'description' => 'Bitmap of permissions this actor has'], 'roles' => ['type' => 'int', 'not null' => true, 'description' => 'Bitmap of permissions this actor has'],
'type' => ['type' => 'int', 'not null' => true, 'description' => 'The type of actor (person, group, bot, etc)'], 'type' => ['type' => 'int', 'not null' => true, 'description' => 'The type of actor (person, group, bot, etc)'],
'homepage' => ['type' => 'text', 'description' => 'identifying URL'], 'homepage' => ['type' => 'text', 'description' => 'identifying URL'],
'bio' => ['type' => 'text', 'description' => 'descriptive biography'], 'bio' => ['type' => 'text', 'description' => 'descriptive biography'],