<commit_before><?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- Agregamos esta regla porque si no solo puede ver las surveys abiertas -->
        <record id="survey_administrator_access" model="ir.rule">
            <field name="name">Administrator survey access rights</field>
            <field name="model_id" ref="survey.model_survey_survey"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
            <field eval="1" name="perm_unlink"/>
            <field eval="1" name="perm_write"/>
            <field eval="1" name="perm_read"/>
            <field eval="1" name="perm_create"/>
        </record>

        <!-- We create the Portal App -->
        <record model="ir.module.category" id="module_category_portal">
            <field name="name">Portal</field>
            <field name="sequence">0</field>
            <field name="visible" eval="0" />
        </record>       

        <!-- Portal Student Group -->
        <record id="base.group_portal_student" model="res.groups">
            <field name="name">Student's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal')),(4, ref('base.group_survey_user'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Student's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>

        <!-- Portal Teacher Group -->
        <record id="base.group_portal_teacher" model="res.groups">
            <field name="name">Teacher's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal_student')),(4, ref('base.group_survey_see_scores'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Teacher's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>        
       
    <!-- Portal Administrator Group -->
        <record id="base.group_portal_administrator" model="res.groups">
            <field name="name">Administrator's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal_teacher'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Administrator's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>

        <!-- Groups view -->
        <record model="ir.rule" id="res_partner_group_administrator_rule">
            <field name="name">portal administrator: only section groups</field>
            <field name="model_id" ref="academic.model_academic_group"/>
            <field name="domain_force">[('level_id.section_id','=',user.partner_id.section_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>

        <!-- Groups Evaluations view -->
        <record model="ir.rule" id="res_partner_group_evaluation_administrator_rule">
            <field name="name">portal administrator: only section groups evaluation</field>
            <field name="model_id" ref="academic.model_academic_group_evaluation"/>
            <field name="domain_force">[('group_id.level_id.section_id','=',user.partner_id.section_id.id),('state','!=','invisible')]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>

        <!-- Partner -->
        <record model="ir.rule" id="res_partner_portal_administrator_rule">
            <field name="name">res_partner: portal administrator: full access all partners</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>   

        <record model="ir.rule" id="res_partner_portal_teacher_rule">
            <field name="name">res_partner: portal teacher: read access all partners</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
        </record>

        <!-- Portal user input  -->
        <record model="ir.rule" id="survey_input_student_full_rule">
            <field name="name">survey input: portal student: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_student'))]"/>
        </record>

<!-- le dimos full acces porque el director tiene que poder forzar el cierre de evaluaciones y demas -->
        <record model="ir.rule" id="survey_input_administrator_full_rule">
            <field name="name">survey input: portal administrator: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">['|',('group_id','=',False),('group_id.level_id.section_id','=',user.partner_id.section_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>              

        <!-- Old rules that where improoved with new desing of partner_id and apply_to_id  -->
<!--         <record model="ir.rule" id="survey_input_student_full_rule">
            <field name="name">survey input: portal student: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'student'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_student'))]"/>
        </record>        

        <record model="ir.rule" id="survey_input_teacher_full_rule">
            <field name="name">survey input: portal teacher: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'teacher'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
        </record>

        <record model="ir.rule" id="survey_input_administrator_full_rule">
            <field name="name">survey input: portal administrator: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'administrator'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>    -->

        <record model="ir.rule" id="survey_input_teacher_read_rule">
            <field name="name">survey input: portal teacher: read access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.apply_to', '!=', 'administrator')]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_crate" eval="False"/>
            <field name="perm_unlink" eval="False"/>            
        </record>
<!-- le dimos full acces mas arriba porque el director tiene que poder forzar el cierre de evaluaciones y demas -->
<!--         <record model="ir.rule" id="survey_input_administrator_read_rule">
            <field name="name">survey input: portal administrator: read access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
            <field name="perm_read" eval="True"/><commit_msg>FIX xml data order on portal module<commit_after><?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- We create the Portal App -->
        <record model="ir.module.category" id="module_category_portal">
            <field name="name">Portal</field>
            <field name="sequence">0</field>
            <field name="visible" eval="0" />
        </record>       

        <!-- Portal Student Group -->
        <record id="base.group_portal_student" model="res.groups">
            <field name="name">Student's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal')),(4, ref('base.group_survey_user'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Student's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>

        <!-- Portal Teacher Group -->
        <record id="base.group_portal_teacher" model="res.groups">
            <field name="name">Teacher's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal_student')),(4, ref('base.group_survey_see_scores'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Teacher's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>        
       
    <!-- Portal Administrator Group -->
        <record id="base.group_portal_administrator" model="res.groups">
            <field name="name">Administrator's Portal</field>
            <field name="implied_ids" eval="[(4, ref('base.group_portal_teacher'))]"/>
            <field name="category_id" ref="module_category_portal"/>
            <field name="comment">Administrator's Portal members have specific access rights (such as record rules and restricted menus).
                They usually do not belong to the usual OpenERP groups.</field>
        </record>

        <!-- Groups view -->
        <record model="ir.rule" id="res_partner_group_administrator_rule">
            <field name="name">portal administrator: only section groups</field>
            <field name="model_id" ref="academic.model_academic_group"/>
            <field name="domain_force">[('level_id.section_id','=',user.partner_id.section_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>

        <!-- Groups Evaluations view -->
        <record model="ir.rule" id="res_partner_group_evaluation_administrator_rule">
            <field name="name">portal administrator: only section groups evaluation</field>
            <field name="model_id" ref="academic.model_academic_group_evaluation"/>
            <field name="domain_force">[('group_id.level_id.section_id','=',user.partner_id.section_id.id),('state','!=','invisible')]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>

        <!-- Partner -->
        <record model="ir.rule" id="res_partner_portal_administrator_rule">
            <field name="name">res_partner: portal administrator: full access all partners</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>   

        <record model="ir.rule" id="res_partner_portal_teacher_rule">
            <field name="name">res_partner: portal teacher: read access all partners</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
        </record>

        <!-- Portal user input  -->
        <record model="ir.rule" id="survey_input_student_full_rule">
            <field name="name">survey input: portal student: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_student'))]"/>
        </record>

<!-- le dimos full acces porque el director tiene que poder forzar el cierre de evaluaciones y demas -->
        <record model="ir.rule" id="survey_input_administrator_full_rule">
            <field name="name">survey input: portal administrator: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">['|',('group_id','=',False),('group_id.level_id.section_id','=',user.partner_id.section_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>              

        <!-- Old rules that where improoved with new desing of partner_id and apply_to_id  -->
<!--         <record model="ir.rule" id="survey_input_student_full_rule">
            <field name="name">survey input: portal student: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'student'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_student'))]"/>
        </record>        

        <record model="ir.rule" id="survey_input_teacher_full_rule">
            <field name="name">survey input: portal teacher: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'teacher'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
        </record>

        <record model="ir.rule" id="survey_input_administrator_full_rule">
            <field name="name">survey input: portal administrator: full access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.answered_by', '=', 'administrator'),('partner_id','=',user.partner_id.id)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
        </record>    -->

        <record model="ir.rule" id="survey_input_teacher_read_rule">
            <field name="name">survey input: portal teacher: read access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[('survey_id.apply_to', '!=', 'administrator')]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_teacher'))]"/>
            <field name="perm_read" eval="True"/>
            <field name="perm_write" eval="False"/>
            <field name="perm_crate" eval="False"/>
            <field name="perm_unlink" eval="False"/>            
        </record>

        <!-- Agregamos esta regla porque si no solo puede ver las surveys abiertas -->
        <record id="survey_administrator_access" model="ir.rule">
            <field name="name">Administrator survey access rights</field>
            <field name="model_id" ref="survey.model_survey_survey"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
            <field eval="1" name="perm_unlink"/>
            <field eval="1" name="perm_write"/>
            <field eval="1" name="perm_read"/>
            <field eval="1" name="perm_create"/>
        </record>
                
<!-- le dimos full acces mas arriba porque el director tiene que poder forzar el cierre de evaluaciones y demas -->
<!--         <record model="ir.rule" id="survey_input_administrator_read_rule">
            <field name="name">survey input: portal administrator: read access survey inputs</field>
            <field name="model_id" ref="survey.model_survey_user_input"/>
            <field name="domain_force">[(1, '=', 1)]</field>
            <field name="groups" eval="[(4, ref('base.group_portal_administrator'))]"/>
            <field name="perm_read" eval="True"/>
{'fraction_non_alphanumeric': 0.1599010192658929, 'fraction_numerical': 0.0040063630471926, 'mean_word_length': 3.0530085959885387, 'pattern_counts': {'":': 0, '<': 307, '<?xml version=': 2, '>': 305, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415365', 'n_tokens_mistral': 4975, 'n_tokens_neox': 4924, 'n_words': 1015}