def remove_permission(auth_user: AuthUser, username: str, project_sfdc_id: str): if auth_user.username not in admin_list: return {'error': 'unauthorized'} cla.log.info('project ({}) removed for ({}) by {}'.format( project_sfdc_id, username, auth_user.username)) user_permission = UserPermissions() try: user_permission.load(username) except Exception as err: print('Unable to update user permission: {}'.format(err)) return {'error': err} event_data = 'User {} permission removed to project {}'.format( username, project_sfdc_id) user_permission.remove_project(project_sfdc_id) user_permission.save() Event.create_event( event_type=EventType.RemovePermission, event_data=event_data, event_summary=event_data, event_project_id=project_sfdc_id, contains_pii=True, )
def remove_permission(auth_user: AuthUser, username: str, project_sfdc_id: str): if auth_user.username not in admin_list: return {'error': 'unauthorized'} cla.log.info('project ({}) removed for ({}) by {}'.format( project_sfdc_id, username, auth_user.username)) user_permission = UserPermissions() try: user_permission.load(username) except Exception as err: print('Unable to update user permission: {}'.format(err)) return {'error': err} user_permission.remove_project(project_sfdc_id) user_permission.save()