Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
416 changes: 416 additions & 0 deletions app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions app/Swagger/Models/BaseUserSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'BaseUser',
title: 'Base User',
description: 'Base User serialized representation',
type: 'object',
allOf: [
new OA\Schema(ref: '#/components/schemas/Base'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(property: 'first_name', type: 'string', description: 'First name', example: 'John'),
new OA\Property(property: 'last_name', type: 'string', description: 'Last name', example: 'Doe'),
new OA\Property(property: 'pic', type: 'string', format: 'uri', description: 'Profile picture URL'),
]
)
]
)]
class BaseUserSchema
{
}
27 changes: 27 additions & 0 deletions app/Swagger/Models/GroupSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'Group',
title: 'Group',
description: 'Group serialized representation',
type: 'object',
allOf: [
new OA\Schema(ref: '#/components/schemas/Base'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(property: 'name', type: 'string', description: 'Group name'),
new OA\Property(property: 'slug', type: 'string', description: 'Group slug'),
new OA\Property(property: 'active', type: 'boolean', description: 'Whether the group is active'),
new OA\Property(property: 'default', type: 'boolean', description: 'Whether the group is a default group'),
]
)
]
)]
class GroupSchema
{
}
90 changes: 90 additions & 0 deletions app/Swagger/Models/UserInfoResponseSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace App\Swagger\schemas;

use OAuth2\AddressClaim;
use OAuth2\StandardClaims;
use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'UserInfoAddressClaim',
title: 'Address Claim',
description: 'OpenID Connect Address Claim (RFC 5.1.1)',
type: 'object',
properties: [
new OA\Property(property: AddressClaim::Country, type: 'string', description: 'Country name'),
new OA\Property(property: AddressClaim::StreetAddress, type: 'string', description: 'Full street address component'),
new OA\Property(property: AddressClaim::Address1, type: 'string', description: 'Address line 1'),
new OA\Property(property: AddressClaim::Address2, type: 'string', description: 'Address line 2'),
new OA\Property(property: AddressClaim::PostalCode, type: 'string', description: 'Zip code or postal code'),
new OA\Property(property: AddressClaim::Region, type: 'string', description: 'State, province, or region'),
new OA\Property(property: AddressClaim::Locality, type: 'string', description: 'City or locality'),
new OA\Property(property: AddressClaim::Formatted, type: 'string', description: 'Full mailing address, formatted for display'),
]
)]
class UserInfoAddressClaimSchema
{
}

#[OA\Schema(
schema: 'UserInfoResponse',
title: 'UserInfo Response',
description: 'OpenID Connect UserInfo endpoint response. Claims returned depend on the requested scopes (profile, email, address).',
type: 'object',
required: [StandardClaims::SubjectIdentifier, 'aud'],
properties: [
// JWT standard claims
new OA\Property(property: StandardClaims::SubjectIdentifier, type: 'string', description: 'Subject identifier for the End-User'),
new OA\Property(property: 'aud', type: 'string', description: 'Audience (client ID)'),

// Profile scope claims
new OA\Property(property: StandardClaims::Name, type: 'string', description: 'Full name'),
new OA\Property(property: StandardClaims::GivenName, type: 'string', description: 'First name'),
new OA\Property(property: StandardClaims::PreferredUserName, type: 'string', description: 'Preferred username'),
new OA\Property(property: StandardClaims::FamilyName, type: 'string', description: 'Last name'),
new OA\Property(property: StandardClaims::NickName, type: 'string', description: 'Casual name or identifier'),
new OA\Property(property: StandardClaims::Picture, type: 'string', format: 'uri', description: 'Profile picture URL'),
new OA\Property(property: StandardClaims::Birthdate, type: 'string', description: 'Date of birth'),
new OA\Property(property: StandardClaims::Gender, type: 'string', description: 'Gender'),
new OA\Property(property: StandardClaims::GenderSpecify, type: 'string', description: 'Gender specification'),
new OA\Property(property: StandardClaims::Locale, type: 'string', description: 'Preferred language'),
new OA\Property(property: StandardClaims::Bio, type: 'string', description: 'User biography'),
new OA\Property(property: StandardClaims::StatementOfInterest, type: 'string', description: 'Statement of interest'),
new OA\Property(property: StandardClaims::Irc, type: 'string', description: 'IRC handle'),
new OA\Property(property: StandardClaims::GitHubUser, type: 'string', description: 'GitHub username'),
new OA\Property(property: StandardClaims::WeChatUser, type: 'string', description: 'WeChat username'),
new OA\Property(property: StandardClaims::TwitterName, type: 'string', description: 'Twitter handle'),
new OA\Property(property: StandardClaims::LinkedInProfile, type: 'string', description: 'LinkedIn profile URL'),
new OA\Property(property: StandardClaims::Company, type: 'string', description: 'Company name'),
new OA\Property(property: StandardClaims::JobTitle, type: 'string', description: 'Job title'),
new OA\Property(property: StandardClaims::ShowPicture, type: 'boolean', description: 'Show photo in public profile'),
new OA\Property(property: StandardClaims::ShowBio, type: 'boolean', description: 'Show bio in public profile'),
new OA\Property(property: StandardClaims::ShowSocialMediaInfo, type: 'boolean', description: 'Show social media info in public profile'),
new OA\Property(property: StandardClaims::ShowFullName, type: 'boolean', description: 'Show full name in public profile'),
new OA\Property(property: StandardClaims::AllowChatWithMe, type: 'boolean', description: 'Allow chat in public profile'),
new OA\Property(property: StandardClaims::ShowTelephoneNumber, type: 'boolean', description: 'Show telephone in public profile'),
new OA\Property(
property: StandardClaims::Groups,
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Group'),
description: 'User groups'
),

// Email scope claims
new OA\Property(property: StandardClaims::Email, type: 'string', format: 'email', description: 'Primary email address'),
new OA\Property(property: StandardClaims::SecondEmail, type: 'string', format: 'email', description: 'Secondary email address'),
new OA\Property(property: StandardClaims::ThirdEmail, type: 'string', format: 'email', description: 'Tertiary email address'),
new OA\Property(property: StandardClaims::EmailVerified, type: 'boolean', description: 'Whether the primary email is verified'),
new OA\Property(property: StandardClaims::ShowEmail, type: 'boolean', description: 'Whether to show the email or not'),

// Address scope claims
new OA\Property(
property: StandardClaims::Address,
ref: '#/components/schemas/UserInfoAddressClaim',
description: 'End-User preferred postal address (address scope)'
),
]
)]
class UserInfoResponseSchema
{
}
64 changes: 64 additions & 0 deletions app/Swagger/Models/UserSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'User',
title: 'User',
description: 'User serialized representation (private)',
type: 'object',
allOf: [
new OA\Schema(ref: '#/components/schemas/BaseUser'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(property: 'email', type: 'string', format: 'email', description: 'Primary email address'),
new OA\Property(property: 'identifier', type: 'string', description: 'User unique identifier string'),
new OA\Property(property: 'email_verified', type: 'boolean', description: 'Whether the primary email is verified'),
new OA\Property(property: 'bio', type: 'string', nullable: true, description: 'User biography'),
new OA\Property(property: 'address1', type: 'string', description: 'Address line 1'),
new OA\Property(property: 'address2', type: 'string', nullable: true, description: 'Address line 2'),
new OA\Property(property: 'city', type: 'string', description: 'City'),
new OA\Property(property: 'state', type: 'string', description: 'State or province'),
new OA\Property(property: 'post_code', type: 'string', description: 'Postal code'),
new OA\Property(property: 'country_iso_code', type: 'string', description: 'ISO country code'),
new OA\Property(property: 'second_email', type: 'string', format: 'email', nullable: true, description: 'Secondary email address'),
new OA\Property(property: 'third_email', type: 'string', format: 'email', nullable: true, description: 'Tertiary email address'),
new OA\Property(property: 'gender', type: 'string', nullable: true, description: 'Gender'),
new OA\Property(property: 'gender_specify', type: 'string', nullable: true, description: 'Gender specification'),
new OA\Property(property: 'statement_of_interest', type: 'string', nullable: true, description: 'Statement of interest'),
new OA\Property(property: 'irc', type: 'string', nullable: true, description: 'IRC handle'),
new OA\Property(property: 'linked_in_profile', type: 'string', nullable: true, description: 'LinkedIn profile URL'),
new OA\Property(property: 'github_user', type: 'string', nullable: true, description: 'GitHub username'),
new OA\Property(property: 'wechat_user', type: 'string', nullable: true, description: 'WeChat username'),
new OA\Property(property: 'twitter_name', type: 'string', nullable: true, description: 'Twitter handle'),
new OA\Property(property: 'language', type: 'string', nullable: true, description: 'Preferred language'),
new OA\Property(property: 'birthday', type: 'integer', nullable: true, description: 'Date of birth (epoch)'),
new OA\Property(property: 'phone_number', type: 'string', nullable: true, description: 'Phone number'),
new OA\Property(property: 'company', type: 'string', nullable: true, description: 'Company name'),
new OA\Property(property: 'job_title', type: 'string', nullable: true, description: 'Job title'),
new OA\Property(property: 'spam_type', type: 'string', description: 'Spam classification', enum: ['None', 'Spam', 'Ham']),
new OA\Property(property: 'last_login_date', type: 'integer', nullable: true, description: 'Last login date (epoch)'),
new OA\Property(property: 'active', type: 'boolean', description: 'Whether the user account is active'),
new OA\Property(property: 'public_profile_show_photo', type: 'boolean', description: 'Show photo in public profile'),
new OA\Property(property: 'public_profile_show_fullname', type: 'boolean', description: 'Show full name in public profile'),
new OA\Property(property: 'public_profile_show_email', type: 'boolean', description: 'Show email in public profile'),
new OA\Property(property: 'public_profile_show_social_media_info', type: 'boolean', description: 'Show social media info in public profile'),
new OA\Property(property: 'public_profile_show_bio', type: 'boolean', description: 'Show bio in public profile'),
new OA\Property(property: 'public_profile_allow_chat_with_me', type: 'boolean', description: 'Allow chat in public profile'),
new OA\Property(property: 'public_profile_show_telephone_number', type: 'boolean', description: 'Show telephone in public profile'),
new OA\Property(
property: 'groups',
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Group'),
description: 'User groups (expandable with expand=groups)'
),
]
)
]
)]
class UserSchema
{
}
26 changes: 26 additions & 0 deletions app/Swagger/OAuth2UserApiControllerSchemas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'PaginatedUserResponseSchema',
type: 'object',
allOf: [
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(
property: 'data',
type: 'array',
items: new OA\Items(ref: '#/components/schemas/User')
)
]
)
]
)]
class PaginatedUserResponseSchema
{
}
30 changes: 30 additions & 0 deletions app/Swagger/Requests/CreateUserRequestSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php namespace App\Swagger\schemas;

/**
* Copyright 2025 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 OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'CreateUserRequest',
title: 'Create User Request',
description: 'Request body for creating a new user. Only email is required, all other fields are optional.',
type: 'object',
required: ['email'],
allOf: [
new OA\Schema(ref: '#/components/schemas/UserFields')
]
)]
class CreateUserRequestSchema
{
}
36 changes: 36 additions & 0 deletions app/Swagger/Requests/UpdateUserGroupsRequestSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php namespace App\Swagger\schemas;

/**
* Copyright 2025 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 OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'UpdateUserGroupsRequest',
title: 'Update User Groups Request',
description: 'Request body for updating user group assignments',
type: 'object',
required: ['groups'],
properties: [
new OA\Property(
property: 'groups',
type: 'array',
items: new OA\Items(type: 'integer'),
description: 'Array of group IDs to assign to the user',
example: [1, 2, 3]
)
]
)]
class UpdateUserGroupsRequestSchema
{
}
35 changes: 35 additions & 0 deletions app/Swagger/Requests/UpdateUserPicRequestSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php namespace App\Swagger\schemas;

/**
* Copyright 2025 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 OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'UpdateUserPicRequest',
title: 'Update User Profile Picture Request',
description: 'Request body for uploading a user profile picture',
type: 'object',
required: ['file'],
properties: [
new OA\Property(
property: 'file',
description: 'Profile picture image file',
type: 'string',
format: 'binary'
),
]
)]
class UpdateUserPicRequestSchema
{
}
29 changes: 29 additions & 0 deletions app/Swagger/Requests/UpdateUserRequestSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php namespace App\Swagger\schemas;

/**
* Copyright 2025 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 OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'UpdateUserRequest',
title: 'Update User Request',
description: 'Request body for updating a user. All fields are optional. Note: groups, email_verified, and active fields are automatically removed from non-admin requests.',
type: 'object',
allOf: [
new OA\Schema(ref: '#/components/schemas/UserFields')
]
)]
class UpdateUserRequestSchema
{
}
Loading
Loading