Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rhul-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Whyte Cameron (2023) ZMAC302
rhul-scripts
Commits
28f2fbce
Commit
28f2fbce
authored
2 years ago
by
Hague Matthew UXAC009
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Make module-info give you the intersection of multiple args"
This reverts commit
e9b37c00
.
parent
e9b37c00
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ldap/README.md
+2
-3
2 additions, 3 deletions
ldap/README.md
ldap/rhul-module-info.py
+19
-19
19 additions, 19 deletions
ldap/rhul-module-info.py
moodle/quiz-change-times.py
+1
-11
1 addition, 11 deletions
moodle/quiz-change-times.py
with
22 additions
and
33 deletions
ldap/README.md
+
2
−
3
View file @
28f2fbce
...
...
@@ -8,9 +8,8 @@ registrations.
*
`rhul-student-info.py`
-- get student module registrations, email, and
id number. E.g.
`python rhul-student-info.py "Matthew" for all
Matthews.
* `
rhul-module-info.py
` -- get list of students on a module. E.g. `
python
rhul-module-info.py CS1811
`. Specifying multiple modules gets you the
intersection.
* `
rhul-module-info.py
` -- get list of students on a module. E.g.
`
python rhul-module-info.py CS1811
`.
* `
rhul-programme-info.py
` -- get list of students on a programme. E.g.
`
python rhul-programme-info.py Software 2
` for all 2nd year students
on a Software Engineering degree.
...
...
This diff is collapsed.
Click to expand it.
ldap/rhul-module-info.py
+
19
−
19
View file @
28f2fbce
...
...
@@ -14,7 +14,7 @@ LOGIN_RE = re.compile(".*([A-Z]{4}[0-9]{3}).*")
LOGIN_RE_GRP
=
1
if
len
(
sys
.
argv
)
<
2
:
print
(
'
Please pass
at least one
module code.
'
)
print
(
'
Please pass module code.
'
)
exit
(
-
1
)
search_term
=
sys
.
argv
[
1
]
...
...
@@ -29,14 +29,12 @@ BASE='DC=cc,DC=rhul,DC=local'
USERNAME
=
'
matthew.hague@rhul.ac.uk
'
PASS_CMD
=
[
os
.
path
.
expanduser
(
'
~/.config/mutt/getpass.sh
'
),
'
rhul
'
]
filter
=
"
(&
"
for
mod_code
in
sys
.
argv
[
1
:]:
mod_filter
=
"
(|
"
+
\
""
.
join
(
f
"
{
filter
.
format
(
mod_code
=
mod_code
)
}
"
for
filter
in
MOD_FILTERS
)
+
\
"
)
"
filter
+=
mod_filter
filter
+=
"
)
"
if
len
(
sys
.
argv
)
<
2
:
print
(
'
Please pass a search term.
'
)
exit
(
-
1
)
mod_code
=
sys
.
argv
[
1
]
student_attrs
=
[
"
displayName
"
,
"
mail
"
,
"
extensionAttribute2
"
,
"
extensionAttribute3
"
,
"
description
"
...
...
@@ -55,15 +53,17 @@ with ldap3.Connection(URI,
authentication
=
ldap3
.
SIMPLE
)
as
conn
:
count
=
0
writer
.
writerow
([
"
count
"
,
"
name
"
,
"
id
"
,
"
email
"
,
"
login
"
,
"
description
"
])
conn
.
search
(
BASE
,
filter
,
attributes
=
student_attrs
)
for
student
in
conn
.
entries
:
count
+=
1
writer
.
writerow
([
count
,
student
.
displayName
,
student
.
extensionAttribute3
,
student
.
mail
,
student
.
extensionAttribute2
,
student
.
description
])
for
filter_fmt
in
MOD_FILTERS
:
mod_filter
=
filter_fmt
.
format
(
mod_code
=
mod_code
)
conn
.
search
(
BASE
,
mod_filter
,
attributes
=
student_attrs
)
for
student
in
conn
.
entries
:
count
+=
1
writer
.
writerow
([
count
,
student
.
displayName
,
student
.
extensionAttribute3
,
student
.
mail
,
student
.
extensionAttribute2
,
student
.
description
])
This diff is collapsed.
Click to expand it.
moodle/quiz-change-times.py
+
1
−
11
View file @
28f2fbce
...
...
@@ -21,7 +21,6 @@
import
browser_cookie3
import
csv
import
getopt
import
os
import
re
import
sys
...
...
@@ -33,12 +32,6 @@ from selenium.webdriver.common.by import By
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.support.ui
import
Select
from
selenium.webdriver.support.ui
import
WebDriverWait
from
selenium.webdriver.firefox.options
import
Options
TMPDIR
=
"
/tmp/firefox
"
if
not
os
.
path
.
exists
(
TMPDIR
):
os
.
mkdir
(
TMPDIR
)
os
.
environ
[
"
TMPDIR
"
]
=
TMPDIR
MOODLE_URL
=
"
https://moodle.royalholloway.ac.uk
"
QUIZ_EDIT_URL
\
...
...
@@ -61,10 +54,7 @@ class Browser:
self
.
driver
=
None
def
__enter__
(
self
):
ffbinary
=
"
/var/lib/flatpak/exports/bin/org.mozilla.firefox
"
ops
=
Options
()
ops
.
binary_location
=
ffbinary
self
.
driver
=
webdriver
.
Firefox
(
options
=
ops
)
self
.
driver
=
webdriver
.
Firefox
()
self
.
driver
.
implicitly_wait
(
WAIT_TIMEOUT
)
return
self
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment