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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/check-lang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
repository: ${{ env.DOCKER_EXMENT_REPOSITORY}}
repository: oreno4649/docker-exment
path: ./docker-exment
ref: fix/mysql-warning

- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
repository: ${{ env.DOCKER_EXMENT_REPOSITORY}}
repository: oreno4649/docker-exment
path: ./docker-exment
ref: fix/mysql-warning

- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
repository: ${{ env.DOCKER_EXMENT_REPOSITORY}}
repository: oreno4649/docker-exment
path: ./docker-exment
ref: fix/mysql-warning

- uses: actions/checkout@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions database/migrations/2019_05_18_164730_support_for_v1_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public function down()
/**
* drop custom table's table
*/
// @phpstan-ignore-next-line
protected function dropExmTables()
{
if (!Schema::hasColumn('custom_tables', 'deleted_at')) {
Expand All @@ -112,6 +113,7 @@ protected function dropExmTables()
/**
* hard delete
*/
// @phpstan-ignore-next-line
protected function deleteRecord($table_name, $classname)
{
if (!Schema::hasColumn($table_name, 'deleted_at')) {
Expand All @@ -126,6 +128,7 @@ protected function deleteRecord($table_name, $classname)
/**
* add key's index
*/
// @phpstan-ignore-next-line
protected function addIndex()
{
foreach (static::ADD_INDEX_TABLES as $table_name => $column_name) {
Expand All @@ -144,6 +147,7 @@ protected function addIndex()
/**
* add deleted_at key's index
*/
// @phpstan-ignore-next-line
protected function addDeletedIndex()
{
// add deleted_at index in custom values table
Expand Down Expand Up @@ -181,6 +185,7 @@ protected function addDeletedIndex()
/**
* drop deleted record
*/
// @phpstan-ignore-next-line
protected function dropDeletedRecord($table)
{
if (stripos($table, 'exm__') === 0 || $table == 'custom_values') {
Expand All @@ -205,6 +210,7 @@ protected function dropDeletedRecord($table)
/**
* drop deleted record
*/
// @phpstan-ignore-next-line
protected function dropSuuidUnique($table)
{
$columns = \Schema::getUniqueDefinitions($table, 'suuid');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
$table->timestamp('deleted_at', 0)->nullable()->after('updated_at');
}
if (!Schema::hasColumn('revisions', 'delete_user_id')) {
/** @phpstan-ignore-next-line unsignedInteger() expects bool, int given */
// @phpstan-ignore-next-line
$table->unsignedInteger('delete_user_id', 0)->nullable()->after('create_user_id');
}
});
Expand Down
46 changes: 5 additions & 41 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:
parameters:
paths:
- vendor/exceedone/exment
level: 5
level: 7
stubFiles:
- exment/stubs/laravel/passport/Client.stub
universalObjectCratesClasses:
Expand Down Expand Up @@ -49,46 +49,6 @@ parameters:
message: "#^Return type \\(Illuminate\\\\View\\\\View\\) of method Exceedone\\\\Exment\\\\Form\\\\Field\\\\NestedEmbeds::render\\(\\) should be compatible with return type \\(string\\) of method Illuminate\\\\Contracts\\\\Support\\\\Renderable::render\\(\\)#"
path: vendor/exceedone/exment/src/*

-
message: "#^Static call to instance method Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterSftp::getMergeConfigKeys\\(\\).#"
path: vendor/exceedone/exment/src/*

-
message: "#^Argument of an invalid type Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterSftp supplied for foreach, only iterables are supported.#"
path: vendor/exceedone/exment/src/*

-
message: "#^Argument of an invalid type Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterS3 supplied for foreach, only iterables are supported.#"
path: vendor/exceedone/exment/src/*

-
message: "#^Static call to instance method Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterS3::getMergeConfigKeys\\(\\).#"
path: vendor/exceedone/exment/src/*

-
message: "#^Argument of an invalid type Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterLocal supplied for foreach, only iterables are supported.#"
path: vendor/exceedone/exment/src/*

-
message: "#^Static call to instance method Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterLocal::getMergeConfigKeys\\(\\).#"
path: vendor/exceedone/exment/src/*

-
message: "#^Argument of an invalid type Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterFtp supplied for foreach, only iterables are supported.#"
path: vendor/exceedone/exment/src/*

-
message: "#^Static call to instance method Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterFtp::getMergeConfigKeys\\(\\).#"
path: vendor/exceedone/exment/src/*

-
message: "#^Argument of an invalid type Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterAzure supplied for foreach, only iterables are supported.#"
path: vendor/exceedone/exment/src/*

-
message: "#^Static call to instance method Exceedone\\\\Exment\\\\Storage\\\\Adapter\\\\ExmentAdapterAzure::getMergeConfigKeys\\(\\).#"
path: vendor/exceedone/exment/src/*

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model::setValueModel\\(\\)#"
path: vendor/exceedone/exment/src/*
Expand Down Expand Up @@ -140,3 +100,7 @@ parameters:
-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Auth\\\\Authenticatable::#"
path: vendor/exceedone/exment/src/*

-
message: "#^Part .* of encapsed string cannot be cast to string\\.#"
path: vendor/exceedone/exment/src/*
5 changes: 5 additions & 0 deletions src/Auth/ApiKeyGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function respondToAccessTokenRequest(
return $responseType;
}

/**
* @return UserEntityInterface
*/
protected function validateUser(ServerRequestInterface $request, ClientEntityInterface $client)
{
$api_key = $this->getRequestParameter('api_key', $request);
Expand Down Expand Up @@ -82,6 +85,8 @@ public function getIdentifier()

/**
* {@inheritdoc}
* @param string $api_key
* @return UserEntityInterface|null
*/
public function getUserEntityByUserCredentials($api_key)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/ExmentPasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExmentPasswordBroker extends PasswordBroker
/**
* Get the user for the given credentials.
*
* @param array $credentials
* @param array<string, mixed> $credentials
* @return \Illuminate\Contracts\Auth\CanResetPassword|null
*
* @throws \UnexpectedValueException
Expand Down
17 changes: 17 additions & 0 deletions src/Auth/HasPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ trait HasPermissions
use Authenticatable;
use CanResetPassword;

// @phpstan-ignore-next-line
public function isAdministrator()
{
return collect(System::system_admin_users())->contains($this->getUserId());
Expand All @@ -34,6 +35,7 @@ public function isAdministrator()
* $role_key * if set array, check whether either items.
* @param array|string $role_key
*/
// @phpstan-ignore-next-line
public function hasPermission($role_key)
{
// if system doesn't use role, return true
Expand Down Expand Up @@ -72,6 +74,7 @@ public function hasPermission($role_key)
* Checking also each table. If there is even one, return true.
* @param array|string $role_key
*/
// @phpstan-ignore-next-line
public function hasPermissionContainsTable($role_key)
{
// if system doesn't use role, return true
Expand Down Expand Up @@ -104,6 +107,7 @@ public function hasPermissionContainsTable($role_key)
* @param Plugin $plugin
* @param array|string $role_key
*/
// @phpstan-ignore-next-line
public function hasPermissionPlugin($plugin, $role_key)
{
// if system doesn't use role, return true
Expand Down Expand Up @@ -158,6 +162,7 @@ public function hasPermissionPlugin($plugin, $role_key)
* whether user has no permission
* if no permission, show message on dashboard
*/
// @phpstan-ignore-next-line
public function noPermission()
{
// if system doesn't use role, return false
Expand All @@ -178,6 +183,7 @@ public function noPermission()
*
* @return Collection
*/
// @phpstan-ignore-next-line
public function allPermissions(): Collection
{
// get request session about role
Expand Down Expand Up @@ -215,6 +221,7 @@ public function allPermissions(): Collection
}

/** @var Collection $collection */
// @phpstan-ignore-next-line
$collection = collect($permissions);
return $collection;
}
Expand All @@ -225,6 +232,7 @@ public function allPermissions(): Collection
* @param $role_key
* @return Collection
*/
// @phpstan-ignore-next-line
public function allHasPermissionTables($role_key): Collection
{
$results = [];
Expand All @@ -237,6 +245,7 @@ public function allHasPermissionTables($role_key): Collection
}
}
/** @var Collection $collection */
// @phpstan-ignore-next-line
$collection = collect($results);
return $collection;
}
Expand All @@ -250,6 +259,7 @@ public function allHasPermissionTables($role_key): Collection
*
* @return bool
*/
// @phpstan-ignore-next-line
public function visible($item, $target_tables = []): bool
{
if (is_string($item)) {
Expand Down Expand Up @@ -304,6 +314,7 @@ public function visible($item, $target_tables = []): bool
* https://exment.net/docs/#/ja/developing_memo
* @return array
*/
// @phpstan-ignore-next-line
public function getOrganizationIdsForQuery($filterType = JoinedOrgFilterType::ALL)
{
return System::requestSession(Define::SYSTEM_KEY_SESSION_ORGANIZATION_IDS . '_' . $filterType, function () use ($filterType) {
Expand All @@ -323,6 +334,7 @@ public function getOrganizationIdsForQuery($filterType = JoinedOrgFilterType::AL
* @param string $filterType
* @return array offset 0 : type, 1 : user or organization id.
*/
// @phpstan-ignore-next-line
public function getUserAndOrganizationIds($filterType = JoinedOrgFilterType::ALL)
{
$results = [[SystemTableName::USER, $this->getUserId()]];
Expand All @@ -339,6 +351,7 @@ public function getUserAndOrganizationIds($filterType = JoinedOrgFilterType::ALL
/**
* get permisson array.
*/
// @phpstan-ignore-next-line
protected function getPermissions()
{
$authority = System::requestSession(Define::SYSTEM_KEY_SESSION_AUTHORITY, function () {
Expand All @@ -354,6 +367,7 @@ protected function getPermissions()
/**
* get all permissons for all custom tables.
*/
// @phpstan-ignore-next-line
protected function getCustomTablePermissions()
{
// get all permissons for system. --------------------------------------------------
Expand Down Expand Up @@ -412,6 +426,7 @@ protected function getCustomTablePermissions()
/**
* get Plugin permissons.
*/
// @phpstan-ignore-next-line
protected function getPluginPermissions()
{
// get all permissons for system. --------------------------------------------------
Expand Down Expand Up @@ -457,6 +472,7 @@ protected function getPluginPermissions()
/**
* get all permissons for system.
*/
// @phpstan-ignore-next-line
protected function getSystemPermissions()
{
// get all permissons for system. --------------------------------------------------
Expand Down Expand Up @@ -492,6 +508,7 @@ protected function getSystemPermissions()
return $permissions;
}

// @phpstan-ignore-next-line
protected function getPermissionItems()
{
$enum = JoinedOrgFilterType::getEnum(System::org_joined_type_role_group(), JoinedOrgFilterType::ALL);
Expand Down
1 change: 1 addition & 0 deletions src/Auth/PasswordBrokerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected function resolve($name)

return new PasswordBroker(
$this->createTokenRepository($config),
// @phpstan-ignore-next-line
$this->app['auth']->createUserProvider($config['provider'])
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Auth/PasswordGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ protected function validateUser(ServerRequestInterface $request, ClientEntityInt
/**
* {@inheritdoc}
*/
// @phpstan-ignore-next-line
public function getUserEntityByUserCredentials($username, $password, $login_type, $login_setting, $grantType, ClientEntityInterface $clientEntity)
{
$provider = config('auth.guards.api.provider');
Expand All @@ -110,14 +111,17 @@ public function getUserEntityByUserCredentials($username, $password, $login_type
];

if (method_exists($model, 'findForPassport')) {
// @phpstan-ignore-next-line
$user = (new $model())->findForPassport($username, $credentials);
} else {
// @phpstan-ignore-next-line
$user = (new $model())->where('email', $username)->first();
}

if (! $user) {
return;
} elseif (method_exists($user, 'validateForPassportPasswordGrant')) {
// @phpstan-ignore-next-line
if (! $user->validateForPassportPasswordGrant($password, $credentials)) {
return;
}
Expand Down
Loading