Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Authorization

Aperta
#8 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php

Direzione di ricerca

Start by reviewing the REST API annotation and request-processing entry points, then determine how this authorization layer depends on the yet-to-be-created authentication layer. Define how class and method @require annotations handle roles and user-defined functions, and verify that protected methods allow or reject requests according to those rules.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement help wanted

Based on top of a yet-to-be-created authentication layer, the REST APIs should support authorization: limiting certain methods to authenticated users and their roles

Basic idea

use web\Response;

#[@require(['admin'])]
class Administration {

  /** Deletes a URL by a given ID */
  #[@delete('/{id}')]
  public function delete(string $id): Response {
    // ...
  }
}

The require annotation makes the surrounding layer perform checks on the authenticated user. By annotating the containing class all its methods will be affected.

  • @require(['admin']) - requires the user to be in the admin role
  • @require(['admin', 'user']) - requires the user to be in the admin or user role
  • @require(function($user) { ... }) - runs a user-defined function on the user. Allows access if function returns true.
Lingua principale
PHP
Stelle
2
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di xp-forge/rest-api

Tutte le issue di xp-forge/rest-api

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.