mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +00:00 
			
		
		
		
	 22f3123e94
			
		
	
	
		22f3123e94
		
			
		
	
	
	
	
		
			
			* feat(admin): add Auth feature * refactor: authentication to use redux-toolkit * chore(admin): convert admin data-fetching to use redux-toolkit-query * chore: add docs * fix: default logo would not show on login page * fix: app flashes on logout * fix: logout should work across browsers
		
			
				
	
	
		
			91 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import type { errors } from '@strapi/utils';
 | |
| import { Entity, Permission } from './shared';
 | |
| 
 | |
| export interface Action {
 | |
|   actionId: string;
 | |
|   applyToProperties: string[];
 | |
|   label: string;
 | |
|   subjects: string[];
 | |
| }
 | |
| 
 | |
| export interface SubjectProperty {
 | |
|   children?: SubjectProperty[];
 | |
|   label: string;
 | |
|   required?: boolean;
 | |
|   value: string;
 | |
| }
 | |
| 
 | |
| export interface Subject {
 | |
|   label: string;
 | |
|   properties: SubjectProperty[];
 | |
|   uid: string;
 | |
| }
 | |
| 
 | |
| export interface ContentPermission {
 | |
|   actions: Action[];
 | |
|   subjects: Subject[];
 | |
| }
 | |
| 
 | |
| export interface SettingPermission {
 | |
|   action: string;
 | |
|   displayName: string;
 | |
|   category: string;
 | |
|   subCategory: string;
 | |
| }
 | |
| 
 | |
| export interface PluginPermission {
 | |
|   action: string;
 | |
|   displayName: string;
 | |
|   plugin: string;
 | |
|   subCategory: string;
 | |
| }
 | |
| 
 | |
| export interface Condition {
 | |
|   id: string;
 | |
|   displayName: string;
 | |
|   category: string;
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * GET /permission - List all permissions
 | |
|  */
 | |
| export declare namespace GetAll {
 | |
|   export interface Request {
 | |
|     query: {};
 | |
|     body: {};
 | |
|     params: {
 | |
|       role: Entity['id'];
 | |
|     };
 | |
|   }
 | |
| 
 | |
|   export interface Response {
 | |
|     data: {
 | |
|       conditions: Condition[];
 | |
|       sections: {
 | |
|         collectionTypes: ContentPermission;
 | |
|         plugins: PluginPermission[];
 | |
|         settings: SettingPermission[];
 | |
|         singleTypes: ContentPermission;
 | |
|       };
 | |
|     };
 | |
|     error?: errors.ApplicationError;
 | |
|   }
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * POST /permission/check - Check if the current user has the given permissions
 | |
|  */
 | |
| export declare namespace Check {
 | |
|   export interface Request {
 | |
|     query: {};
 | |
|     body: {
 | |
|       permissions: (Pick<Permission, 'action' | 'subject'> & { field?: string })[];
 | |
|     };
 | |
|   }
 | |
| 
 | |
|   export interface Response {
 | |
|     data: boolean[];
 | |
|     error?: errors.ApplicationError | errors.YupValidationError;
 | |
|   }
 | |
| }
 |