def all_permissions_for_user_in_course(user, course_id):
 course = modulestore().get_course(course_id)
 if (course is None):
  raise ItemNotFoundError(course_id)
 all_roles = {role.name for role in Role.objects.filter(users=user, course_id=course_id)}
 permissions = {permission.name for permission in Permission.objects.filter(roles__users=user, roles__course_id=course_id) if (not permission_blacked_out(course, all_roles, permission.name))}
 return permissions

def all_permissions_for_user_in_course ( user , course_id ) : course = modulestore ( ) . get_course ( course_id ) if ( course is None ) : raise ItemNotFoundError ( course_id ) all_roles = { role . name for role in Role . objects . filter ( users = user , course_id = course_id ) } permissions = { permission . name for permission in Permission . objects . filter ( roles__users = user , roles__course_id = course_id ) if ( not permission_blacked_out ( course , all_roles , permission . name ) ) } return permissions
returns all the permissions the user has in the given course .