58 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace nur\v\vp;
 | |
| 
 | |
| use nur\config;
 | |
| use nur\v\base\AbstractPage;
 | |
| use nur\v\page;
 | |
| 
 | |
| /**
 | |
|  * Class AInitPage: une page basique sans support de l'authentification
 | |
|  */
 | |
| abstract class AInitPage extends AbstractPage {
 | |
|   /** la connexion en mode développement est-elle autorisée? */
 | |
|   function isDevauthAllowed(): bool {
 | |
|     return config::k("dev_devauth") && config::is_devel();
 | |
|   }
 | |
| 
 | |
|   /** nom de l'utilisateur avec lequel se connecter en mode développement */
 | |
|   function getDevUsername(): string {
 | |
|     return config::k("dev_username");
 | |
|   }
 | |
| 
 | |
|   function getCasUrl(): string {
 | |
|     return config::k("cas_url", "https://casn.univ-reunion.fr/cas");
 | |
|   }
 | |
|   function getCasLoginUrl(): string {
 | |
|     $casUrl = $this->getCasUrl();
 | |
|     return config::k("cas_login_url", "$casUrl/login");
 | |
|   }
 | |
|   function getCasLogoutUrl(): string {
 | |
|     $casUrl = $this->getCasUrl();
 | |
|     return config::k("cas_logout_url", "$casUrl/logout");
 | |
|   }
 | |
| 
 | |
|   /** obtenir l'url d'authentification CAS. cet url doit être *relatif* */
 | |
|   function getCasauthUrl(): string {
 | |
|     if ($this->isDevauthAllowed()) {
 | |
|       return page::bu(config::k("devauth_page", "_devauth.php"));
 | |
|     } else {
 | |
|       return page::bu(config::k("casauth_page", "_casauth.php"));
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   function getLogoutUrl(): string {
 | |
|     return page::bu(config::k("logout_page","_logout.php"));
 | |
|   }
 | |
| 
 | |
|   function getLoginUrl(): string {
 | |
|     return page::bu(config::k("login_page", "login.php"));
 | |
|   }
 | |
| 
 | |
|   function getMainUrl(): string {
 | |
|     return page::bu(config::k("main_page", "index.php"));
 | |
|   }
 | |
| 
 | |
|   function print(): void {
 | |
|   }
 | |
| }
 |