MCPcopy Index your code
hub / github.com/diffgram/diffgram / remove_user

Method remove_user

default/methods/share/share.py:351–396  ·  view source on GitHub ↗

(self)

Source from the content-addressed store, hash-verified

349 self.session.add(auth_api)
350
351 def remove_user(self):
352 """
353
354 """
355
356 # TODO what parts of this are shared with auth and what parts are user only
357
358 # TODO current operating on member or some other name
359 # Instead of going back and forth...
360
361 # Do we want to do this, or check if the user has the project in their user.projects...
362 # Context of security model that we don't know till this point if a user / member thing
363 # being passes this way is actually valid.
364 # Realized that if the project key doesn't exist that that will fail, could use a .get()
365
366 self.user_to_modify = self.member_to_modify.user
367
368 if self.project not in self.user_to_modify.projects:
369 self.log['error']['permission_error'] = "Check right user / project combination"
370 return
371
372 # Remove all permissions
373 current_perms = self.user_to_modify.permissions_projects[self.project_string_id].copy()
374 for i in range(0, len(current_perms)):
375 user_current_permission = current_perms[i]
376 # user_current_permission = self.user_to_modify.permissions_projects[self.project_string_id][0]
377
378 deletion = Deletion(project = self.project,
379 member_created = self.user_who_made_request.member,
380 mode = 'remove_users_project_permission')
381 self.session.add(deletion)
382
383 deletion.cache = {}
384 deletion.cache['user_modified'] = self.user_to_modify.id
385
386 deletion.cache['permissions'] = user_current_permission
387
388 # TODO error handling here...
389 Project_permissions.remove(
390 session = self.session,
391 permission = user_current_permission,
392 user = self.user_to_modify,
393 sub_type = self.project_string_id,
394 log = self.log)
395 self.session.add(self.user_to_modify)
396 self.user_to_modify.projects.remove(self.project)
397
398 def email_existing_user(
399 self,

Callers 1

removeMethod · 0.95

Calls 4

DeletionClass · 0.90
copyMethod · 0.80
addMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected