def property_list_detail(request, plist_id): """ Fetches one plist From: property_list/<plist_id>/ :param request: :param plist_id: :return render: """ plist = Recipe.objects(id=plist_id) return render(request, 'public_gate/property_list_detail.html', dict(plist=plist[0]))
def property_lists_for_user(request): """ Fetches plists for specific user From: user/<user_id>/property_list/ :param request: :param user_id: :return render: """ property_lists = {} if settings.RETRIEVE_PLIST_FROM_GROUPS == "all": groups = request.user.ldap_user.group_names else: groups = {request.user.ldap_user.attrs['gidnumber'][0]} for group in groups: plists = Recipe.objects(group_name=group) if len(plists) > 0: for plist in plists: plist.id = str(plist.id) property_lists[group] = Recipe.objects(group_name=group) return render(request, 'public_gate/property_lists.html', dict(property_lists=property_lists))
def property_list_download(request, plist_id): """ Fetches one plist and converts it to plist format (xml based) From: property_list/<plist_id>/download/ :param request: :param plist_id: :return: """ plist = Recipe.objects(id=plist_id) plist = plist[0].generate() response = render(request, 'public_gate/property_list_download.html', dict(plist=plist), content_type="application/x-apple-aspen-config") response['Content-Disposition'] = "attachment; filename={plist_id}.mobileconfig".format(plist_id=plist_id) return response