Merge branch 'dev_odex25_helpdesk' into seronetoone
This commit is contained in:
commit
f86b46aa2f
|
|
@ -23,38 +23,38 @@ jobs:
|
||||||
#######################################################
|
#######################################################
|
||||||
# 🟦 1) Allowed Users List
|
# 🟦 1) Allowed Users List
|
||||||
#######################################################
|
#######################################################
|
||||||
ALLOWED_USERS=(
|
# ALLOWED_USERS=(
|
||||||
"expsa"
|
# "expsa"
|
||||||
"moutazmuhammad"
|
# "moutazmuhammad"
|
||||||
"ronozoro"
|
# "ronozoro"
|
||||||
"Abubaker-Altaib"
|
# "Abubaker-Altaib"
|
||||||
"altexp"
|
# "altexp"
|
||||||
"the5abir"
|
# "the5abir"
|
||||||
"ahmadaking"
|
# "ahmadaking"
|
||||||
"kchyounes19"
|
# "kchyounes19"
|
||||||
"abdurrahman-saber"
|
# "abdurrahman-saber"
|
||||||
"maltayyar2"
|
# "maltayyar2"
|
||||||
"esam-sermah"
|
# "esam-sermah"
|
||||||
"mohammed-alkhazrji"
|
# "mohammed-alkhazrji"
|
||||||
)
|
# )
|
||||||
|
|
||||||
IS_ALLOWED="false"
|
# IS_ALLOWED="false"
|
||||||
for user in "${ALLOWED_USERS[@]}"; do
|
# for user in "${ALLOWED_USERS[@]}"; do
|
||||||
if [[ "$CREATOR" == "$user" ]]; then
|
# if [[ "$CREATOR" == "$user" ]]; then
|
||||||
IS_ALLOWED="true"
|
# IS_ALLOWED="true"
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
done
|
# done
|
||||||
|
|
||||||
if [[ "$IS_ALLOWED" == "false" ]]; then
|
# if [[ "$IS_ALLOWED" == "false" ]]; then
|
||||||
echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
|
# echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
|
||||||
curl -s -X DELETE \
|
# curl -s -X DELETE \
|
||||||
-H "Authorization: token $GH_TOKEN" \
|
# -H "Authorization: token $GH_TOKEN" \
|
||||||
https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
|
# https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "✔ User '$CREATOR' is allowed."
|
# echo "✔ User '$CREATOR' is allowed."
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
# 🟦 2) Reserved Branch Names (Your Existing List)
|
# 🟦 2) Reserved Branch Names (Your Existing List)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ on:
|
||||||
- dev_odex25_helpdesk
|
- dev_odex25_helpdesk
|
||||||
- dev_odex25_donation
|
- dev_odex25_donation
|
||||||
- dev_odex25_ensan
|
- dev_odex25_ensan
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_pr_author:
|
check_pr_author:
|
||||||
runs-on: linting_odex25-standard-modules_runner
|
runs-on: linting_odex25-standard-modules_runner
|
||||||
|
|
@ -74,29 +75,35 @@ jobs:
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
core.info("All PR authors are allowed.");
|
||||||
|
|
||||||
// Check commit authors
|
# // Check commit authors
|
||||||
const commitList = await github.rest.pulls.listCommits({
|
# const commitList = await github.rest.pulls.listCommits({
|
||||||
owner,
|
# owner,
|
||||||
repo,
|
# repo,
|
||||||
pull_number: pr.number
|
# pull_number: pr.number
|
||||||
});
|
# });
|
||||||
|
|
||||||
for (const commit of commitList.data) {
|
# core.info("PR author is allowed.");
|
||||||
const commitAuthor = commit.author ? commit.author.login : null;
|
|
||||||
|
|
||||||
if (commitAuthor && !allowed.includes(commitAuthor)) {
|
# // Uncomment below if you want to block unauthorized commit authors also
|
||||||
core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
# /*
|
||||||
|
# for (const commit of commitList.data) {
|
||||||
|
# const commitAuthor = commit.author ? commit.author.login : null;
|
||||||
|
|
||||||
await github.rest.pulls.update({
|
# if (commitAuthor && !allowed.includes(commitAuthor)) {
|
||||||
owner,
|
# core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
||||||
repo,
|
|
||||||
pull_number: pr.number,
|
|
||||||
state: "closed"
|
|
||||||
});
|
|
||||||
|
|
||||||
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.");
|
||||||
|
# */
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,16 @@ class HelpdeskTicket(models.Model):
|
||||||
'user_id': team.get_new_user(ticket_type),
|
'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
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<tree string="Members" editable="bottom">
|
<tree string="Members" editable="bottom">
|
||||||
<field name="member_id" required="1" context="{'members':parent.members_ids}"/>
|
<field name="member_id" required="1" context="{'members':parent.members_ids}"/>
|
||||||
<!-- <field name="ticket_type_ids" required="1" widget="many2many_tags"/>-->
|
<!-- <field name="ticket_type_ids" required="1" widget="many2many_tags"/>-->
|
||||||
<field name="service_id" required="1" widget="many2many_tags"/>
|
<field name="service_id" widget="many2many_tags"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue