openstackid/database/migrations/Version20200811151509.php
smarcet 8ff349761d New OAUTH2 endpoints to update user info (ME)
PUT /api/v1/users/me

payload

'first_name' => 'sometimes|string',
'last_name' => 'sometimes|string',
'email' => 'sometimes|email',
'identifier' => 'sometimes|string',
'bio' => 'nullable|string',
'address1' => 'nullable|string',
'address2' => 'nullable|string',
'city' => 'nullable|string',
'state' => 'nullable|string',
'post_code' => 'nullable|string',
'country_iso_code' => 'nullable|country_iso_alpha2_code',
'second_email' => 'nullable|email',
'third_email' => 'nullable|email',
'gender' => 'nullable|string',
'gender_specify' => 'nullable|string',
'statement_of_interest' => 'nullable|string',
'irc' => 'nullable|string',
'linked_in_profile' => 'nullable|string',
'github_user' => 'nullable|string',
'wechat_user' => 'nullable|string',
'twitter_name' => 'nullable|string',
'language' => 'nullable|string',
'birthday' => 'nullable|date_format:U',
'password' => 'sometimes|string|min:8|confirmed',
'phone_number' => 'nullable|string',
'company' => 'nullable|string',

required scopes

me/write

PUT /api/v1/users/me/pic

multiform encoding

pic: file (png, jpg, jpeg)

required scopes

me/write

Change-Id: I31a1edd9eb1fcdee228a8f5ba1b44d324116edd9
Signed-off-by: smarcet <smarcet@gmail.com>
2020-08-12 10:01:18 -03:00

84 lines
2.6 KiB
PHP

<?php namespace Database\Migrations;
/**
* Copyright 2020 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use App\libs\OAuth2\IUserScopes;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema as Schema;
use SeedUtils;
/**
* Class Version20200811151509
* @package Database\Migrations
*/
class Version20200811151509 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
SeedUtils::seedScopes([
[
'name' => IUserScopes::MeRead,
'short_description' => 'Allows access to read your Profile',
'description' => 'Allows access to read your Profile',
'system' => false,
'default' => false,
'groups' => false,
],
], 'users');
SeedUtils::seedScopes([
[
'name' => IUserScopes::MeWrite,
'short_description' => 'Allows access to write your Profile',
'description' => 'Allows access to write your Profile',
'system' => false,
'default' => false,
'groups' => false,
],
], 'users');
SeedUtils::seedApiEndpoints('users', [
[
'name' => 'update-my-user',
'active' => true,
'route' => '/api/v1/users/me',
'http_method' => 'PUT',
'scopes' => [
\App\libs\OAuth2\IUserScopes::MeWrite
],
],
[
'name' => 'update-my-user-pic',
'active' => true,
'route' => '/api/v1/users/me/pic',
'http_method' => 'PUT',
'scopes' => [
\App\libs\OAuth2\IUserScopes::MeWrite
],
],
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
}
}