/** * [getData get data at the status data is ture] * @return [array] [return set of data status is true] */ public static function getData() { $user_role = new Usernhc(); $role_id = $user_role->getRoleName()->role_id; //Get role id $rs_policy = RolePolicy::where('role_id', '=', $role_id)->select('policy_id')->get()->toArray(); //Get relate policy $policy_id = $rs_policy[0]['policy_id']; //Policy id $data_id = DataPolicy::where('policy_id', '=', $policy_id)->select('data_id')->get()->toArray(); $data_id = array_flatten($data_id); // Data id that relate with policy $rs_dataid = DataPrivacy::where('status', '=', true)->whereIn('data_id', $data_id)->distinct()->get(array('data_id')); foreach ($rs_dataid->toArray() as $key => $value) { $id[] = $value['data_id']; } //$dataid_set = implode("','", $id); //Displays 'A', 'B', 'C' return $id; }
/** * [policyRBACDelAction remove each rbac relate with policy id] * @param [integer] $id [policy id] * @return [type] [description] */ public function policyRBACDelAction($id) { $role_obj = new RolePolicy(); $role_obj->delDataById($id); $data_obj = new DataPolicy(); $data_obj->delDataById($id); $cond_obj = new ConditionPolicy(); $cond_obj->delDataById($id); $purp_obj = new PurposePolicy(); $purp_obj->delDataById($id); $obl_obj = new ObligationPolicy(); $obl_obj->delDataById($id); $action_obj = new ActionPolicy(); $action_obj->delDataById($id); return Redirect::to('/policy-rbac/' . $id)->with('success', 'อาร์บีเอซี:มีนโยบายคลังฯรหัส = ' . $id . ' ลบทิ้งสำเร็จ'); }
/** * [delDataById description] * @param integer $id policy id * @return array $datas data id information and count */ public function delDataById($id) { $data = DataPolicy::where('policy_id', '=', $id)->delete(); }