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/1175 #1139

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions girderformindlogger/api/api_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .v1 import account, activity, api_key, applet, assetstore, collection, context, \
file, folder, group, invitation, item, protocol, relationship, resource, \
response, schedule, screen, system, token, user, notification, account_profile, applet_library, \
theme
theme, cases


class ApiDocs(object):
Expand Down Expand Up @@ -52,5 +52,6 @@ def _addV1ToNode(node):
node.v1.account = account_profile.AccountProfile()
node.v1.library = applet_library.AppletLibrary()
node.v1.theme = theme.Theme()

node.v1.cases = cases.Cases()

return node
44 changes: 16 additions & 28 deletions girderformindlogger/api/v1/applet.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,32 +682,7 @@ def deleteUserFromApplet(self, applet, profileId, deleteResponse=True):
applet['_id'] not in accountProfile.get('applets', {}).get('coordinator', []):
raise AccessException('You don\'t have enough permission to perform this action')

for role in USER_ROLE_KEYS:
if role != 'user':
profile = self._model.revokeRole(applet, profile, role)

profile = self._model.revokeRole(applet, profile, 'user')

ResponseAlerts().deleteResponseAlerts(profile['_id'])

if deleteResponse:
ProfileModel().remove(profile)
else:
profile['reviewers'] = []
profile['deactivated'] = True

ProfileModel().save(profile, validate=False)

if deleteResponse:
from girderformindlogger.models.response_folder import ResponseItem

ResponseItem().removeWithQuery(
query={
"baseParentType": 'user',
"baseParentId": profile['userId'],
"meta.applet.@id": applet['_id']
}
)
self._model.deleteUserFromApplet(applet, profile, deleteResponse)

return ({
'message': 'successfully removed user from applet'
Expand Down Expand Up @@ -1434,6 +1409,18 @@ def prepareAppletForEdit(self, applet, thread, params):
dataType='array',
default=''
)
.param(
'caseId',
'id of case',
required=False,
default=None
)
.param(
'entryId',
'id of entry',
required=False,
default=None
)
.jsonParam(
'pagination',
'pagination info - allow, pageIndex fields are available',
Expand All @@ -1442,7 +1429,7 @@ def prepareAppletForEdit(self, applet, thread, params):
)
.errorResponse('Write access was denied for this applet.', 403)
)
def getAppletData(self, id, users, pagination):
def getAppletData(self, id, users, caseId, entryId, pagination):
from datetime import datetime
from ..rest import setContentDisposition, setRawResponse, setResponseHeader

Expand All @@ -1452,7 +1439,8 @@ def getAppletData(self, id, users, pagination):
users = users.replace(' ', '').split(",")

users = users if users else []
data = AppletModel().getResponseData(id, thisUser, users, pagination)

data = AppletModel().getResponseData(id, thisUser, users, caseId, entryId, pagination)

setContentDisposition("{}-{}.{}".format(
str(id),
Expand Down
Loading