class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
import magic
from django import forms
from django.core.exceptions import ValidationError
from django.template.defaultfilters import filesizeformat
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
import threading
from contextlib import contextmanager
_state = threading.local()
package session
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
import { Exclude, Expose } from 'class-transformer';
export class User {
id: string;
firstName: string;
require "loofah"
class HtmlSanitizer
ALLOWED_TAGS = %w[p br a strong em ul ol li blockquote code pre h2 h3].freeze
ALLOWED_ATTRS = %w[href title].freeze
SAFE_SCHEMES = %w[http https mailto].freeze
package web
import (
"bytes"
"html/template"
"net/http"
public class PayloadLimitFilter extends OncePerRequestFilter {
private final long maxBytes;
private final Set<String> allowedTypes;
public PayloadLimitFilter(long maxBytes, Set<String> allowedTypes) {
const jwt = require('jsonwebtoken');
const SECRET = process.env.JWT_SECRET;
const ALGORITHM = 'HS256';
const ACCESS_TTL = '15m';
const jwt = require('jsonwebtoken');
function authenticate(req, res, next) {
const header = req.headers.authorization || '';
const [scheme, token] = header.split(' ');
const { AsyncLocalStorage } = require('async_hooks');
const storage = new AsyncLocalStorage();
function runWithTenant(tenantId, userId, callback) {
return storage.run({ tenantId, userId }, callback);