mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 21:18:11 -04:00
feat(access): add scoped grants for team members and API tokens (#12329)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Access\AccessResolver;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use OpenApi\Attributes as OA;
|
||||
@@ -143,10 +144,11 @@ class ApplicationSetting extends Model
|
||||
*/
|
||||
public static function isContainerNamePrefixInUse(string $prefix, Server $server, ?int $ignoreApplicationId = null): bool
|
||||
{
|
||||
return $server->applications()->contains(function (Application $application) use ($prefix, $ignoreApplicationId) {
|
||||
// Hidden applications of a scoped member still count, or two names on one server could collide.
|
||||
return app(AccessResolver::class)->withoutVisibilityScope(fn () => $server->applications()->contains(function (Application $application) use ($prefix, $ignoreApplicationId) {
|
||||
return $application->id !== $ignoreApplicationId
|
||||
&& in_array($prefix, [$application->uuid, $application->settings->custom_container_name_prefix, $application->settings->custom_internal_name], true);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public function stopGracePeriodSeconds(): int
|
||||
|
||||
Reference in New Issue
Block a user