コード例 #1
0
ファイル: testclasses.py プロジェクト: UDJ/UDJ-Server
 def testChangeSongSetPermissionToYes(self):
   playerToChange = Player.objects.get(pk=1)
   ownerGroup = PlayerPermissionGroup.objects.get(player=playerToChange, name=u'owner')
   newPermission = PlayerPermission(player=playerToChange, permission=u'CSS', group=ownerGroup)
   newPermission.save()
   #self.assertFalse(Player.objects.get(pk=1).allow_user_songset)
   response = self.doPost('/udj/0_6/players/1/songset_user_permission', {'songset_user_permission' : 'yes'})
   self.assertEqual(response.status_code, 200, 'Error: ' + response.content)
   #self.assertTrue(Player.objects.get(pk=1).allow_user_songset)
   self.assertFalse(PlayerPermission.objects.filter(player=playerToChange, permission=u'CSS').exists())
コード例 #2
0
def changeSongSetPermission(request, player_id, player):
  if request.POST['songset_user_permission'] == 'yes':
    PlayerPermission.objects.filter(player=player, permission=u'CSS').delete()
  elif request.POST['songset_user_permission'] == 'no':
    ownerGroup = PlayerPermissionGroup.objects.get(player=player, name=u'owner')
    newPermission = PlayerPermission(player=player, permission=u'CSS', group=ownerGroup)
    newPermission.save()
  else:
    return HttpResponse('Invalid permission value', status=400)

  return HttpResponse()
コード例 #3
0
ファイル: player_creation.py プロジェクト: UDJ/UDJ-Server
 def create_perm(perm_name):
   new_perm = PlayerPermission(player=player, permission=perm_name, group=owner_group)
   new_perm.save()