Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into N21-2075-sync-existing-course
Browse files Browse the repository at this point in the history
  • Loading branch information
mrikallab committed Aug 26, 2024
2 parents 447894c + eaf7992 commit 3d9830e
Show file tree
Hide file tree
Showing 31 changed files with 316 additions and 319 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/dependabot-to-jira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ jobs:
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_HTML_URL: ${{ github.event.pull_request.html_url }}
REPO_NAME: ${{ github.event.repository.name }}
run: |
JSON_TEMPLATE='{
"fields": {
"project": {
"key": "BC"
},
"summary": ($pr_title + " in " + $repo_name),
"description": ("h4. Task:\n" + $pr_title + "\n" + $pr_html_url + "\nh4.Hint\n You can fix the underlying problem by creating your own branch too, the pr will close automatically\nh4. Acceptance criteria\n1. https://docs.dbildungscloud.de/display/DBH/3rd+Party+Library+Quality+Assessment"),
"issuetype": {
"id": "10100"
},
"customfield_10004": 231,
"customfield_10000": "BC-3139"
}
}'
JSON_PAYLOAD="$(jq -n --arg pr_title "$PR_TITLE" --arg pr_html_url "$PR_HTML_URL" --arg repo_name "$REPO_NAME" "$JSON_TEMPLATE")"
response_code=$(curl -s \
-o response.txt \
-w "%{http_code}" \
-u ${{ secrets.JIRA_USER_NAME }}:${{ secrets.JIRA_USER_PASSWORD }}\
-H "Content-Type: application/json" \
-X POST --data '{
"fields": {
"project": {
"key": "BC"
},
"summary": "$PR_TITLE in ${{ github.event.repository.name }}",
"description": "h4. Task:\n$PR_TITLE\n$PR_HTML_URL\nh4.Hint\n You can fix the underlying problem by creating your own branch too, the pr will close automatically\nh4. Acceptance criteria\n1. https://docs.dbildungscloud.de/display/DBH/3rd+Party+Library+Quality+Assessment",
"issuetype": {
"id": "10100"
},
"customfield_10004" : 231,
"customfield_10000": "BC-3139"
}
}' \
-X POST --data "$JSON_PAYLOAD" \
'https://ticketsystem.dbildungscloud.de/rest/api/2/issue/');
if [[ $response_code == 2* ]]; then
echo "all good";
Expand All @@ -46,7 +49,7 @@ jobs:
cat response.txt;
exit 1;
fi
created_issue=$(jq -r '.key' response.txt);
echo "created issue: $created_issue";
echo "created_issue=$created_issue" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: setup environment and execute mocha tests
run: npm ci && npm run build && npm run mocha
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM docker.io/node:18 as git
FROM docker.io/node:20 as git

RUN mkdir /app && chown -R node:node /app
WORKDIR /app
COPY .git .
RUN git config --global --add safe.directory /app && echo "{\"sha\": \"$(git rev-parse HEAD)\", \"version\": \"$(git describe --tags --abbrev=0)\", \"commitDate\": \"$(git log -1 --format=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ')\", \"birthdate\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"}" > /app/version

FROM docker.io/node:18-alpine
FROM docker.io/node:20-alpine

ENV TZ=Europe/Berlin

Expand Down
12 changes: 12 additions & 0 deletions ansible/roles/schulcloud-client-core/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: svc.yml.j2
tags:
- service

- name: Configmap
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: configmap.yml.j2
apply: yes
tags:
- configmap

- name: Configmap File
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: client-configmap-files.yml.j2
apply: yes
tags:
- configmap

- name: Secred
kubernetes.core.k8s:
Expand All @@ -25,18 +31,24 @@
template: secret.yml.j2
apply: yes
when: ONEPASSWORD_OPERATOR is undefined or ONEPASSWORD_OPERATOR is defined and not ONEPASSWORD_OPERATOR
tags:
- 1password

- name: Secred by 1Password
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: onepassword.yml.j2
when: ONEPASSWORD_OPERATOR is defined and ONEPASSWORD_OPERATOR|bool
tags:
- 1password


- name: Deployment
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: deployment.yml.j2
tags:
- deployment

18 changes: 11 additions & 7 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@
"type": "string",
"description": "comma separated list of roles which GLOBAL_ANNOUNCEMENT_TEXT is shown to"
},
"DASHBOARD_ANNOUNCEMENT_ENABLED": {
"type": "boolean",
"default": false,
"description": "enbale announcement on dashboard, shown to all user roles specified in DASHBOARD_ANNOUNCEMENT_ROLES"
"DASHBOARD_ANNOUNCEMENT_TEXT": {
"type": "string",
"description": "announcement on dashboard, shown to all user roles specified in DASHBOARD_ANNOUNCEMENT_ROLES"
},
"DASHBOARD_ANNOUNCEMENT_ROLES": {
"type": "string",
Expand Down Expand Up @@ -386,9 +385,14 @@
},
"ACCESSIBILITY_REPORT_EMAIL": {
"type": "string",
"default": "lernen.cloud@dataport.de",
"default": "dbildungscloud@dataport.de",
"description": "Email to report accessibility issue"
},
"TRAINING_URL": {
"type": "string",
"default": "https://lernen.dbildungscloud.de",
"description": "URL for the platform training material"
},
"I18N": {
"type": "object",
"description": "Configuration of I18N",
Expand Down Expand Up @@ -617,10 +621,10 @@
"default": false,
"description": "Enables the media shelf feature"
},
"FEATURE_NEW_LAYOUT_ENABLED": {
"FEATURE_ROOMS_ENABLED": {
"type": "boolean",
"default": false,
"description": "Enables the new layout feature"
"description": "Enables the rooms feature"
}
},
"allOf": [
Expand Down
3 changes: 2 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"FEATURE_LOG_REQUEST": true,
"FEATURE_PROMETHEUS_ENABLED": true,
"FEATURE_ALERTS_ENABLED": true,
"PUBLIC_BACKEND_URL": "http://localhost:3030/api"
"PUBLIC_BACKEND_URL": "http://localhost:3030/api",
"FEATURE_ROOMS_ENABLED": true
}
31 changes: 18 additions & 13 deletions controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ const getUsersWithoutConsent = async (req, roleName, classId) => {
.map((u) => u._id),
consentStatus: { $in: ['missing', 'parentsAgreed'] },
$limit: batchSize,
$sort: { 'lastName': 1},
$sort: { lastName: 1 },
},
})).data,
);
Expand Down Expand Up @@ -2260,6 +2260,8 @@ const schoolUpdateHandler = async (req, res, next) => {
name,
language,
logo_dataUrl,
rocketChat,
videoconference,
} = req.body;

let logo;
Expand All @@ -2270,14 +2272,28 @@ const schoolUpdateHandler = async (req, res, next) => {
};
}

const features = new Set(req.body.features);

if (rocketChat) {
features.add('rocketChat');
} else {
features.delete('rocketChat');
}

if (videoconference) {
features.add('videoconference');
} else {
features.delete('videoconference');
}

const requestBody = {
name,
language,
permissions: {
student: { LERNSTORE_VIEW: false },
teacher: { STUDENT_LIST: false },
},
features: [],
features: Array.from(features),
logo,
};

Expand All @@ -2293,17 +2309,6 @@ const schoolUpdateHandler = async (req, res, next) => {
requestBody.permissions.student.LERNSTORE_VIEW = !!req.body.studentlernstorevisibility;
}

// Update school features
const possibleSchoolFeatures = [
'messenger', 'messengerSchoolRoom', 'messengerStudentRoomCreate', 'rocketChat', 'videoconference',
];

for (const feature of possibleSchoolFeatures) {
if (req.body[feature] === 'true') {
requestBody.features.push(feature);
}
}

await api(req, { version: 'v3' }).patch(`/school/${res.locals.currentSchool}`, {
json: requestBody,
});
Expand Down
28 changes: 28 additions & 0 deletions controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,34 @@ router.get('/teachersOfSchool', async (req, res, next) => {
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
schoolId: user.schoolId,
email: user.email,
}));

return res.json(result);
} catch (err) {
const error = new Error(res.$t('global.text.invalidRequest'));
error.status = 400;
return next(error);
}
});

router.get('/teachersWithEmail', async (req, res, next) => {
try {
const users = await api(req).get('/publicTeachers/', {
qs: {
$limit: false,
email: req.query.email,
$sort: 'firstName',
$populate: ['schoolId'],
},
});

const result = users.data.map((user) => ({
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
schoolName: user.schoolId.name,
}));

return res.json(result);
Expand Down
Loading

0 comments on commit 3d9830e

Please sign in to comment.