mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-16 00:39:32 +00:00
Studiengang allowed endpoint
This commit is contained in:
@@ -23,7 +23,8 @@ class StudiengangEP extends FHCAPI_Controller
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'getStudiengangByKz' => self::PERM_LOGGED
|
||||
'getStudiengangByKz' => self::PERM_LOGGED,
|
||||
'getAllowed' => self::PERM_LOGGED,
|
||||
)
|
||||
);
|
||||
// Load model StudiengangModel
|
||||
@@ -54,4 +55,26 @@ class StudiengangEP extends FHCAPI_Controller
|
||||
}
|
||||
$this->terminateWithSuccess($stg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getAllowed()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('permissions[]', 'Permissions', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
$permissions = $this->input->post('permissions');
|
||||
|
||||
$permittedStgs = [];
|
||||
|
||||
foreach ($permissions as $permission)
|
||||
$permittedStgs = array_merge($permittedStgs, $this->permissionlib->getSTG_isEntitledFor($permission) ?: []);
|
||||
|
||||
$this->terminateWithSuccess($permittedStgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,15 @@ export default {
|
||||
url: '/api/frontend/v1/organisation/StudiengangEP/getStudiengangByKz',
|
||||
params: { studiengang_kz }
|
||||
};
|
||||
}
|
||||
},
|
||||
getAllowed(permissions) {
|
||||
if (!Array.isArray(permissions))
|
||||
permissions = permissions.split(',');
|
||||
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/api/frontend/v1/organisation/StudiengangEP/getAllowed',
|
||||
params: { permissions }
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user