diff --git a/.github/workflows/block_reserved_branches.yml b/.github/workflows/block_reserved_branches.yml index ba3fc471b..4a73aef74 100644 --- a/.github/workflows/block_reserved_branches.yml +++ b/.github/workflows/block_reserved_branches.yml @@ -23,38 +23,38 @@ jobs: ####################################################### # 🟦 1) Allowed Users List ####################################################### - ALLOWED_USERS=( - "expsa" - "moutazmuhammad" - "ronozoro" - "Abubaker-Altaib" - "altexp" - "the5abir" - "ahmadaking" - "kchyounes19" - "abdurrahman-saber" - "maltayyar2" - "esam-sermah" - "mohammed-alkhazrji" - ) + # ALLOWED_USERS=( + # "expsa" + # "moutazmuhammad" + # "ronozoro" + # "Abubaker-Altaib" + # "altexp" + # "the5abir" + # "ahmadaking" + # "kchyounes19" + # "abdurrahman-saber" + # "maltayyar2" + # "esam-sermah" + # "mohammed-alkhazrji" + # ) - IS_ALLOWED="false" - for user in "${ALLOWED_USERS[@]}"; do - if [[ "$CREATOR" == "$user" ]]; then - IS_ALLOWED="true" - break - fi - done + # IS_ALLOWED="false" + # for user in "${ALLOWED_USERS[@]}"; do + # if [[ "$CREATOR" == "$user" ]]; then + # IS_ALLOWED="true" + # break + # fi + # done - if [[ "$IS_ALLOWED" == "false" ]]; then - echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..." - curl -s -X DELETE \ - -H "Authorization: token $GH_TOKEN" \ - https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME - exit 1 - fi + # if [[ "$IS_ALLOWED" == "false" ]]; then + # echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..." + # curl -s -X DELETE \ + # -H "Authorization: token $GH_TOKEN" \ + # https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME + # exit 1 + # fi - echo "✔ User '$CREATOR' is allowed." + # echo "✔ User '$CREATOR' is allowed." ####################################################### # 🟦 2) Reserved Branch Names (Your Existing List) diff --git a/.github/workflows/restrict-pr-authors.yaml b/.github/workflows/restrict-pr-authors.yaml index 5a8e9bab5..56f41ab06 100644 --- a/.github/workflows/restrict-pr-authors.yaml +++ b/.github/workflows/restrict-pr-authors.yaml @@ -31,6 +31,7 @@ on: - dev_odex25_helpdesk - dev_odex25_donation - dev_odex25_ensan + jobs: check_pr_author: runs-on: linting_odex25-standard-modules_runner @@ -74,29 +75,35 @@ jobs: }); return; } + core.info("All PR authors are allowed."); - // Check commit authors - const commitList = await github.rest.pulls.listCommits({ - owner, - repo, - pull_number: pr.number - }); +# // Check commit authors +# const commitList = await github.rest.pulls.listCommits({ +# owner, +# repo, +# pull_number: pr.number +# }); - for (const commit of commitList.data) { - const commitAuthor = commit.author ? commit.author.login : null; +# core.info("PR author is allowed."); - if (commitAuthor && !allowed.includes(commitAuthor)) { - core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`); +# // Uncomment below if you want to block unauthorized commit authors also +# /* +# for (const commit of commitList.data) { +# const commitAuthor = commit.author ? commit.author.login : null; - await github.rest.pulls.update({ - owner, - repo, - pull_number: pr.number, - state: "closed" - }); +# if (commitAuthor && !allowed.includes(commitAuthor)) { +# core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`); - return; - } - } +# await github.rest.pulls.update({ +# owner, +# repo, +# pull_number: pr.number, +# state: "closed" +# }); - core.info("All PR authors and committers are allowed."); +# return; +# } +# } + +# core.info("All PR authors and committers are allowed."); +# */ diff --git a/odex25_helpdesk/odex25_helpdesk_assignation_method/models/helpdesk_team.py b/odex25_helpdesk/odex25_helpdesk_assignation_method/models/helpdesk_team.py index dff8c4456..7c8e76397 100644 --- a/odex25_helpdesk/odex25_helpdesk_assignation_method/models/helpdesk_team.py +++ b/odex25_helpdesk/odex25_helpdesk_assignation_method/models/helpdesk_team.py @@ -21,6 +21,16 @@ class HelpdeskTicket(models.Model): 'user_id': team.get_new_user(ticket_type), } + @api.onchange('user_id') + def _onchange_user_id(self): + for rec in self: + team_member_records = self.env['helpdesk.team.member'].search([('member_id', '=', rec.user_id.id)]) + user_services = team_member_records.mapped('service_id') + if not user_services: + service_domain = [] + else: + service_domain = [('id', 'in', user_services.ids)] + return {'domain': {'service_id': service_domain}} @api.model def create(self, vals): diff --git a/odex25_helpdesk/odex25_helpdesk_assignation_method/views/helpdesk_views.xml b/odex25_helpdesk/odex25_helpdesk_assignation_method/views/helpdesk_views.xml index 0af842550..5ede618dc 100644 --- a/odex25_helpdesk/odex25_helpdesk_assignation_method/views/helpdesk_views.xml +++ b/odex25_helpdesk/odex25_helpdesk_assignation_method/views/helpdesk_views.xml @@ -40,7 +40,7 @@ - +