Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nursix/eden
Browse files Browse the repository at this point in the history
Conflicts:
	private/eden_deploy
  • Loading branch information
nursix committed May 19, 2020
2 parents d5fa170 + f167543 commit d82a74d
Show file tree
Hide file tree
Showing 451 changed files with 63,181 additions and 19,479 deletions.
58 changes: 37 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
dist: xenial
sudo: false
dist: bionic

os: linux
language: python

python:
- "2.7"
- "3.5"
- "3.7"

addons:
apt:
update: true
packages:
- python3-pip
- python3-setuptools
- postgresql-client-10
- postgresql-10-postgis-2.5
- postgresql-10-postgis-2.5-scripts
- postgresql-client-11
- postgresql-11-postgis-2.5
- postgresql-11-postgis-2.5-scripts

# This tests against all the versions of DB supported by Eden
env:
- DB=mysql
- DB=sqlite3
- DB=postgres-9.6
- DB=postgres-9.6+postgis

virtualenv:
system_site_packages: true
- DB=postgres-10
- DB=postgres-10+postgis
- DB=postgres-11
- DB=postgres-11+postgis

services:
- mysql
Expand All @@ -29,29 +40,34 @@ services:
notifications:
email: false

# install web2py
before_install:
- chmod +x tests/travis/*
- sudo tests/travis/install_web2py.sh
- python --version
- pip install -U pip
- chmod +x tests/travis/*

# install Eden. This generates generated_requirements.txt which is given as an
# argument to pip
install:
- sudo tests/travis/install_eden.sh
# Essential dependencies
- pip install python-dateutil
- pip install shapely
- pip install lxml
- pip install psycopg2
# Generated dependencies
- python tests/travis/generate_requirements_file.py tests/travis requirements.txt tests/travis/requirements.txt
- pip install -r tests/travis/generated_requirements.txt
# Install and configure web2py
- tests/travis/install_web2py.sh
# Install and configure Eden
- tests/travis/install_eden.sh

# set up the testing environment
before_script:
- cd ../../web2py/
- sudo chown -R ${USER} .
# configure DB settings based on the env. variable
- ./applications/eden/tests/travis/configure_db.sh
# for debugging in the logs
- cat ./applications/eden/models/000_config.py
# prepop
#- cat ./applications/eden/models/000_config.py
- python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py

script:
- python web2py.py -S eden -M -R applications/eden/modules/unit_tests/suite.py

after_script:
- echo "Travis Test Result" $TRAVIS_TEST_RESULT
- echo "Travis Test Result" $TRAVIS_TEST_RESULT
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DRKCM-1.6.1 (2020-03-13 22:03:05)
DRKCM-1.6.1-1-gd5fa170 (2020-05-19 21:05:56)
87 changes: 53 additions & 34 deletions controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ def user():
]

s3db.configure("auth_user",
create_next = URL(c="admin", f="user", args=["[id]", "roles"]),
create_onaccept = lambda form: auth.s3_approve_user(form.vars),
create_next = URL(c="admin", f="user",
args = ["[id]", "roles"],
),
create_onaccept = lambda form: \
auth.s3_approve_user(form.vars),
list_fields = list_fields,
main = "first_name",
#update_onaccept = lambda form: auth.s3_link_user(form.vars),
Expand All @@ -145,7 +148,8 @@ def approve_user(r, **args):
session.error = T("Can only approve 1 record at a time!")
redirect(URL(args=[]))

user = db(table.id == r.id).select(limitby=(0, 1)).first()
user = db(table.id == r.id).select(limitby = (0, 1)
).first()
auth.s3_approve_user(user)

session.confirmation = T("User Account has been Approved")
Expand All @@ -156,7 +160,8 @@ def link_user(r, **args):
session.error = T("Can only update 1 record at a time!")
redirect(URL(args=[]))

user = db(table.id == r.id).select(limitby=(0, 1)).first()
user = db(table.id == r.id).select(limitby = (0, 1)
).first()
auth.s3_link_user(user)

session.confirmation = T("User has been (re)linked to Person and Human Resource record")
Expand Down Expand Up @@ -207,29 +212,29 @@ def rheader(r):
btn = A(T("Disable"),
_class = "action-btn",
_title = "Disable User",
_href = URL(args=[id, "disable"])
_href = URL(args = [id, "disable"])
)
rheader.append(btn)
if settings.get_auth_show_link():
btn = A(T("Link"),
_class = "action-btn",
_title = "Link (or refresh link) between User, Person & HR Record",
_href = URL(args=[id, "link"])
_href = URL(args = [id, "link"])
)
rheader.append(btn)
#elif registration_key == "pending":
# btn = A(T("Approve"),
# _class = "action-btn",
# _title = "Approve User",
# _href = URL(args=[id, "approve"])
# _href = URL(args = [id, "approve"])
# )
# rheader.append(btn)
else:
# Verify & Approve
btn = A(T("Approve"),
_class = "action-btn",
_title = "Approve User",
_href = URL(args=[id, "approve"])
_href = URL(args = [id, "approve"])
)
rheader.append(btn)

Expand Down Expand Up @@ -282,28 +287,32 @@ def postp(r, output):
restrict = [str(row.id) for row in rows]
s3.actions = [{"label": s3_str(UPDATE),
"url": URL(c="admin", f="user",
args=["[id]", "update"]),
args = ["[id]", "update"],
),
"_class": "action-btn",
},
{"label": s3_str(T("Roles")),
"url": URL(c="admin", f="user",
args=["[id]", "roles"]),
args = ["[id]", "roles"],
),
"_class": "action-btn",
},
{"label": s3_str(T("Disable")),
"restrict": restrict,
"url": URL(c="admin", f="user",
args=["[id]", "disable"]),
args = ["[id]", "disable"],
),
"_class": "action-btn",
"restrict": restrict,
},
]
if settings.get_auth_show_link():
s3.actions.insert(1, {"label": s3_str(T("Link")),
"restrict": restrict,
"url": URL(c="admin", f="user",
args=["[id]", "link"]),
args = ["[id]", "link"],
),
"_class": "action-btn",
"_title": s3_str(T("Link (or refresh link) between User, Person & HR Record")),
"restrict": restrict,
}
)
# Only show the approve button if the user is currently pending
Expand All @@ -313,14 +322,17 @@ def postp(r, output):
rows = db(query).select(table.id)
restrict = [str(row.id) for row in rows]
s3.actions.append({"label": str(T("Approve")),
"url": URL(c="admin", f="user", args=["[id]", "approve"]),
"restrict": restrict,
"url": URL(c="admin", f="user",
args = ["[id]", "approve"],
),
"_class": "action-btn",
})
# Add some highlighting to the rows
query = (table.registration_key.belongs(["disabled", "pending"]))
rows = db(query).select(table.id,
table.registration_key)
table.registration_key,
)
s3.dataTableStyleDisabled = s3.dataTableStyleWarning = [str(row.id) for row in rows if row.registration_key == "disabled"]
s3.dataTableStyleAlert = [str(row.id) for row in rows if row.registration_key == "pending"]

Expand All @@ -337,18 +349,20 @@ def postp(r, output):
if not form:
crud_button = s3base.S3CRUD.crud_button
output["showadd_btn"] = DIV(crud_button(T("Create User"),
_href=URL(args=["create"])),
_href = URL(args = ["create"])
),
crud_button(T("Import Users"),
_href=URL(args=["import"])),
_href = URL(args = ["import"])
),
)
return output
# Assume formstyle callable
id = "auth_user_password_two__row"
label = "%s:" % T("Verify password")
widget = INPUT(_name="password_two",
_id="password_two",
_type="password",
_disabled="disabled",
widget = INPUT(_name = "password_two",
_id = "password_two",
_type = "password",
_disabled = "disabled",
)
comment = ""
row = s3_formstyle(id, label, widget, comment, hidden=True)
Expand Down Expand Up @@ -979,7 +993,8 @@ def postp(r, output):

langlist = sorted(A.get_langcodes())

table = TABLE(_class="translation_module_table")
table = TABLE(_class = "translation_module_table",
)
table.append(BR())

# Set number of columns in the form
Expand Down Expand Up @@ -1188,24 +1203,28 @@ def postp(r, output):

elif opt == "4":
# Add strings manually
div = DIV(T("Upload a text file containing new-line separated strings:"),
INPUT(_type="file", _name="upload"),
BR(),
INPUT(_type="submit", _value=T("Upload")),
)
form.append(div)

if form.accepts(request.vars, session):

# Retrieve strings from the uploaded file
from s3.s3translate import TranslateReadFiles
f = request.vars.upload.file
strings = []
R = TranslateReadFiles()
for line in f:
uploaded_file = request.vars.upload.file
lines = uploaded_file.read().decode("utf-8").splitlines()
for line in lines:
strings.append(line)

# Update the file containing user strings
R.merge_user_strings_file(strings)
from s3.s3translate import TranslateReadFiles
TranslateReadFiles.merge_user_strings_file(strings)

response.confirmation = T("File uploaded")

div = DIV(T("Upload a text file containing new-line separated strings:"),
INPUT(_type="file", _name="upload"),
BR(),
INPUT(_type="submit", _value=T("Upload")),
)
form.append(div)
output["form"] = form

return output
Expand Down
23 changes: 23 additions & 0 deletions controllers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,46 @@
Auth Controllers
"""

# -----------------------------------------------------------------------------
def user():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# -----------------------------------------------------------------------------
def group():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# -----------------------------------------------------------------------------
def membership():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# -----------------------------------------------------------------------------
def domain():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# =============================================================================
def consent():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# -----------------------------------------------------------------------------
def consent_option():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# -----------------------------------------------------------------------------
def processing_type():
"Defined in admin module, so redirect there"

redirect(URL(c="admin", args=request.args, vars=request.vars))

# =============================================================================
2 changes: 1 addition & 1 deletion controllers/br.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def index_alt():
""" Default Module Homepage """

from gluon import current
if auth.s3_has_permission("read", "pr_person", c="br", f="person"):
if current.auth.s3_has_permission("read", "pr_person", c="br", f="person"):
# Just redirect to list of current cases
s3_redirect_default(URL(f="person", vars={"closed": "0"}))

Expand Down
12 changes: 6 additions & 6 deletions controllers/budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def kit_export_xls():
session.error = "xlwt module not available within the running Python - this needs installing for XLS output!"
redirect(URL(c="kit"))

from s3compat import StringIO
output = StringIO()
from s3compat import BytesIO
output = BytesIO()

book = xlwt.Workbook()
# List of Kits
Expand Down Expand Up @@ -305,8 +305,8 @@ def kit_export_pdf():
session.warning = T("No data in this table - cannot create PDF!")
redirect(URL(r=request))

from s3compat import StringIO
output = StringIO()
from s3compat import BytesIO
output = BytesIO()

#class MySubReport(SubReport):
# def __init__(self, db=None, **kwargs):
Expand Down Expand Up @@ -474,8 +474,8 @@ def item_export_pdf():
session.warning = T("No data in this table - cannot create PDF!")
redirect(URL(f="item"))

from s3compat import StringIO
output = StringIO()
from s3compat import BytesIO
output = BytesIO()

class MyReport(Report):
def __init__(self, queryset=None, T=None):
Expand Down
Loading

0 comments on commit d82a74d

Please sign in to comment.