class DownloadsController < ApplicationController
before_action :authenticate_user!, only: :create
skip_before_action :verify_authenticity_token, only: :show
def create
document = current_user.documents.find(params[:document_id])
import { Request, Response } from 'express';
import { authenticate } from './auth.service';
export async function login(req: Request, res: Response): Promise<void> {
const { email, password } = req.body ?? {};
const crypto = require('crypto');
function parseSignatureHeader(header) {
const parts = {};
for (const segment of String(header || '').split(',')) {
const [key, value] = segment.split('=');
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
<?php
namespace App\Models;
use App\Notifications\VerifyEmailNotification;
use Illuminate\Contracts\Auth\MustVerifyEmail;
<?php
namespace App\Security\Voter;
use App\Entity\Comment;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
export const PERMISSIONS = {
READ_POSTS: 'posts:read',
WRITE_POSTS: 'posts:write',
DELETE_POSTS: 'posts:delete',
MANAGE_USERS: 'users:manage',
} as const;
class DownloadsController < ApplicationController
before_action :authenticate_user!
def show
report = current_account.reports.find(params[:report_id])
authorize! :download, report
<?php
namespace App\Controller;
use App\Message\ProcessStripeEvent;
use App\Webhook\StripeSignatureVerifier;
import { Injectable, signal, computed } from '@angular/core';
export interface CurrentUser {
id: string;
email: string;
roles: string[];
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record