Commit af589285 authored by Raph El's avatar Raph El
Browse files

Merge branch 'development' of https://gitlab.adullact.net/pixelhumain/survey into development

parents 9f944568 d13d8ee9
......@@ -652,15 +652,22 @@ class Form {
$res = array("render"=>"co2.views.default.unTpl", "msg"=>Yii::t("project", "Source Copy doesn't exist."),"icon"=>"fa-lock");
return $res;
}
public static function canFormAccess($rules){
$costum = CacheHelper::getCostum();
public static function canFormAccess($rules, $formParents=null){
//WARNING la c'est ce qui est lier à l'user du costum connecté
if(Authorisation::isInterfaceAdmin())
return true;
if(isset($rules["roles"])
&& isset(Yii::app()->session["costum"][$costum["slug"]]["hasRoles"])
&& !empty(array_intersect(Yii::app()->session["costum"][$costum["slug"]]["hasRoles"], $rules["roles"])))
return true;
if(!empty($formParents)){
foreach($formParents as $k => $v){
if(Link::hasRoles($k, $v["type"], $rules["roles"]))
return true;
}
}else{
$costum = CacheHelper::getCostum();
if(isset($rules["roles"])
&& isset(Yii::app()->session["costum"][$costum["slug"]]["hasRoles"])
&& !empty(array_intersect(Yii::app()->session["costum"][$costum["slug"]]["hasRoles"], $rules["roles"])))
return true;
}
return false;
}
// public static function getListAnswersBy($formId, $parent, $userId=null, $cond=null){
......
......@@ -70,7 +70,7 @@ if( isset($form["subForms"]) && count($form["subForms"]) > 1 ) {
$l = 'showStepForm(\'#'.$v.'\')' ;
$activeStep = $k;
}
var_dump($forms); exit;
echo '<a onclick="'.$l.'" href="javascript:;" '.$d.' >';
echo '<div class="stepNumber">'.$lbl.'</div>';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment