Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/google shared drives #561

Merged
merged 46 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
20bfe16
initial shared drive record models
mikeseibel Feb 26, 2024
005774b
mock shared drive data and initial templating
mikeseibel Feb 29, 2024
fc173ff
shared drive api tests
mikeseibel Feb 29, 2024
d002f3e
shared drive loader upsert
mikeseibel Feb 29, 2024
314ab80
Merge branch 'develop' into feature/google-shared-drives
mikeseibel Mar 19, 2024
da31dd4
Merge branch 'develop' into feature/google-shared-drives
mikeseibel Mar 20, 2024
485b97d
itbill restclient
mikeseibel Apr 9, 2024
72f3bfe
shared drive record to unique drive
mikeseibel Apr 9, 2024
cc60f54
random key_remote
mikeseibel Apr 9, 2024
4e25613
layout interactions align with wireframes
mikeseibel Apr 27, 2024
e56ff52
Merge pull request #545 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel Apr 29, 2024
2a61d0a
Merge branch 'develop' into feature/google-shared-drives
mikeseibel Apr 30, 2024
c0fdf09
mock dates
mikeseibel Apr 30, 2024
23d6bdb
itbill payload integration
mikeseibel May 4, 2024
8e6bad7
Merge pull request #547 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 4, 2024
ce4d1b8
subscription relationships
mikeseibel May 4, 2024
74c8d5e
Merge pull request #548 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 4, 2024
42daf34
shared drive email warnings and tests
mikeseibel May 8, 2024
d4d5a11
shared drive notification templating
mikeseibel May 8, 2024
e9dbd64
Merge pull request #549 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 8, 2024
e6c7768
shared drive warning email tweaking
mikeseibel May 8, 2024
1923ad2
Merge pull request #550 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 8, 2024
8649e0c
misnamed metho
mikeseibel May 8, 2024
8b1dc57
Merge pull request #551 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 8, 2024
1978096
consolidate notification logic, add access lifecycle warnings
mikeseibel May 9, 2024
3182223
Merge pull request #552 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 9, 2024
9de0681
setting for conditional app exposure, prod value to prevent unintenti…
mikeseibel May 10, 2024
2acac2d
Merge pull request #553 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 10, 2024
a88d308
support notification display bug
mikeseibel May 10, 2024
6652531
Merge pull request #554 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 10, 2024
8f5acce
improve notification testing
mikeseibel May 10, 2024
8c4bb16
Merge pull request #555 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 10, 2024
e459a50
unused constants
mikeseibel May 10, 2024
d8d8e1e
Merge pull request #556 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 10, 2024
3c0a538
access notice tweaks
mikeseibel May 10, 2024
8212fa3
Merge pull request #557 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 10, 2024
0c028c7
tabs as links
mikeseibel May 14, 2024
ca971ba
Merge pull request #559 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 14, 2024
3be16be
over quota unsubsidized warning, handlebars logic cleanup
mikeseibel May 15, 2024
e566292
a11y updates
wmwash May 15, 2024
d5673e3
feature branch merge
mikeseibel May 15, 2024
98554c7
Merge pull request #560 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 15, 2024
25b8a63
pycodestyle
mikeseibel May 15, 2024
83aa449
Merge pull request #562 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 15, 2024
f70353d
jshint
mikeseibel May 15, 2024
d8ea610
Merge pull request #563 from uw-it-aca/work/google-shared-drives-mikes
mikeseibel May 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ services:
PORT: 8000
AUTH: SAML_MOCK
# ENDORSEMENT_SERVICES: "google, office365"
ITBILL_FORM_URL_BASE: https://uwdev.service-now.com/sp
ITBILL_FORM_URL_BASE_ID: sc_cat_item
ITBILL_SHARED_DRIVE_PRODUCT_SYS_ID: 7078586b2f6cb076cad75ae9aab3ea05
# ENDORSEMENT_PROVISIONING: "services, shared_drives"
# ENDORSEMENT_PROVISIONING: services,mailbox_access
# ENDORSEMENT_PROVISIONING: services
restart: always
container_name: app-provision
build:
Expand Down
2 changes: 2 additions & 0 deletions docker/prod-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ environmentVariables:
value: https://provision.uw.edu/sso/
- name: CLUSTER_CNAME
value: provision.uw.edu
- name: ENDORSEMENT_PROVISIONING
value: services
externalSecrets:
enabled: true
secrets:
Expand Down
15 changes: 15 additions & 0 deletions docker/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
ENDORSEMENT_SERVICES = [s.strip() for s in os.getenv(
'ENDORSEMENT_SERVICES', '*').split(',')]

ENDORSEMENT_PROVISIONING = [s.strip() for s in os.getenv(
'ENDORSEMENT_PROVISIONING', '*').split(',')]

ALLOWED_HOSTS = ['*']

CACHES = {
Expand Down Expand Up @@ -83,6 +86,18 @@
"MSCA_TIMEOUT", RESTCLIENTS_DEFAULT_TIMEOUT)
RESTCLIENTS_MSCA_SUBSCRIPTION_KEY = os.getenv('MSCA_SUBSCRIPTION_KEY', '')

RESTCLIENTS_ITBILL_DAO_CLASS = Live
RESTCLIENTS_ITBILL_HOST=os.getenv('ITBILL_HOST')
RESTCLIENTS_ITBILL_BASIC_AUTH=os.getenv('ITBILL_BASIC_AUTH')

ITBILL_SHARED_DRIVE_SUBSIDIZED_QUOTA=100
ITBILL_SHARED_DRIVE_NAME_FORMAT="GSD_{}"
ITBILL_SHARED_DRIVE_PRODUCT_SYS_ID=os.getenv(
'ITBILL_SHARED_DRIVE_PRODUCT_SYS_ID')
ITBILL_FORM_URL_BASE=os.getenv('ITBILL_FORM_URL_BASE')
ITBILL_FORM_URL_BASE_ID=os.getenv('ITBILL_FORM_URL_BASE_ID')
ITBILL_FORM_URL_SYS_ID=os.getenv('ITBILL_FORM_URL_SYS_ID')

PROVISION_ADMIN_GROUP = 'u_acadev_provision_admin'
PROVISION_SUPPORT_GROUP = 'u_acadev_provision_support'
PROVISION_TEST_GROUP = 'u_acadev_provision_test'
Expand Down
2 changes: 2 additions & 0 deletions docker/test-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ environmentVariables:
value: https://test.provision.uw.edu/saml
- name: CLUSTER_CNAME
value: test.provision.uw.edu
- name: ENDORSEMENT_PROVISIONING
value: services,mailbox_access
externalSecrets:
enabled: true
secrets:
Expand Down
6 changes: 3 additions & 3 deletions endorsement/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def supporttools_globals(request):


def is_desktop(request):
desktopapp = (not getattr(request, 'is_mobile', False) and
not getattr(request, 'is_tablet', False))
return {
'is_desktop': desktopapp
'is_desktop': (not (getattr(
request, 'is_mobile', False) or getattr(
request, 'is_tablet', False)))
}
4 changes: 2 additions & 2 deletions endorsement/dao/endorse.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def _store_endorsement(endorser, endorsee, acted_as, reason, category_code):


def clear_endorsement(endorsement):
if (endorsement.datetime_endorsed is not None and
EndorsementRecord.objects.get_endorsements_for_endorsee(
if (endorsement.datetime_endorsed is not None
and EndorsementRecord.objects.get_endorsements_for_endorsee(
endorsement.endorsee, endorsement.category_code).filter(
datetime_endorsed__isnull=False).count() <= 1):
set_former_category(
Expand Down
72 changes: 72 additions & 0 deletions endorsement/dao/itbill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from django.conf import settings
from userservice.user import UserService
from endorsement.models import SharedDriveRecord, ITBillSubscription
from endorsement.util.itbill.shared_drive import (
subscription_name, product_sys_id)
from endorsement.exceptions import ITBillSubscriptionNotFound
from restclients_core.exceptions import DataFailureException
from uw_itbill.subscription import Subscription
import logging


logger = logging.getLogger(__name__)


def initiate_subscription(shared_drive_record):
if shared_drive_record.subscription:
return

try:
user_service = UserService()
itbill_subscription = ITBillSubscription()
membership = shared_drive_record.shared_drive.members.all()

data = {
"name": subscription_name(shared_drive_record),
"key_remote": itbill_subscription.key_remote,
"product": product_sys_id(),
"start_date": "",
"contact": user_service.get_user(),
"contacts_additional": ','.join([
member.member.name for member in membership]),
"lifecycle_state": ITBillSubscription.SUBSCRIPTION_STATE_CHOICES[
ITBillSubscription.SUBSCRIPTION_DRAFT][1],
"work_notes": "Subscription initiated by Provision Request Tool",
}

Subscription().create_subscription(data)
itbill_subscription.save()
shared_drive_record.subscription = itbill_subscription
shared_drive_record.save()
except Exception as ex:
raise ex

return None


def refresh_subscription(member_netid, drive_id):
record = SharedDriveRecord.objects.get_member_drives(
member_netid, drive_id).get()

load_itbill_subscription(record)


def get_subscription_by_key_remote(key_remote):
try:
return Subscription().get_subscription_by_key_remote(key_remote)
except DataFailureException as ex:
if ex.status == 404:
raise ITBillSubscriptionNotFound(key_remote)

raise


def load_itbill_subscription(record):
"""
Update the subscription record with the latest ITBill data
"""
record.update_subscription(
get_subscription_by_key_remote(record.subscription.key_remote))
Loading
Loading