mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-30 07:58:14 +00:00
Merge branch 'master' of ssh://dev.dredd.it/dreddit-auth
This commit is contained in:
@@ -111,7 +111,6 @@ class EveAPIProxyHandler(BaseHandler):
|
|||||||
obj = get_object_or_404(EVEAccount, pk=params['userid'])
|
obj = get_object_or_404(EVEAccount, pk=params['userid'])
|
||||||
params['apikey'] = obj.api_key
|
params['apikey'] = obj.api_key
|
||||||
|
|
||||||
print params
|
|
||||||
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
|
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
|
||||||
|
|
||||||
return HttpResponse(cached_doc.body)
|
return HttpResponse(cached_doc.body)
|
||||||
|
|||||||
@@ -157,7 +157,11 @@ def import_eve_character(api_key, user_id, character_id):
|
|||||||
else:
|
else:
|
||||||
pchar.gender = 2
|
pchar.gender = 2
|
||||||
|
|
||||||
pchar.race = API_RACES[values['race']]
|
for v in API_RACES_CHOICES:
|
||||||
|
val, race = v
|
||||||
|
if race == values['race']:
|
||||||
|
pchar.race = val
|
||||||
|
break
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
for skill in values['skills']:
|
for skill in values['skills']:
|
||||||
|
|||||||
@@ -43,25 +43,3 @@ API_BLOODLINES_CHOICES = (
|
|||||||
(12, 'Ni-Kunni'),
|
(12, 'Ni-Kunni'),
|
||||||
(13, 'Caldari'),
|
(13, 'Caldari'),
|
||||||
)
|
)
|
||||||
|
|
||||||
API_RACES = {
|
|
||||||
'Caldari': 1,
|
|
||||||
'Minmatar': 2,
|
|
||||||
'Gallente': 3,
|
|
||||||
'Amarr': 4,
|
|
||||||
}
|
|
||||||
|
|
||||||
API_BLOODLINES = {
|
|
||||||
'Sebiestor': 1,
|
|
||||||
'Vherokior': 2,
|
|
||||||
'Brutor': 3,
|
|
||||||
'Intaki': 4,
|
|
||||||
'Gallente': 5,
|
|
||||||
'Jin-Mei': 6,
|
|
||||||
'Civire': 7,
|
|
||||||
'Deteis': 8,
|
|
||||||
'Achura': 9,
|
|
||||||
'Amarr': 10,
|
|
||||||
'Khanid': 11,
|
|
||||||
'Ni-Kunni': 12,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -39,11 +39,6 @@ class EVEAccount(EVEAPIModel):
|
|||||||
verbose_name="API Status",
|
verbose_name="API Status",
|
||||||
help_text="End result of the last attempt at updating this object from the API.")
|
help_text="End result of the last attempt at updating this object from the API.")
|
||||||
|
|
||||||
@property
|
|
||||||
def api_status_description(self):
|
|
||||||
for choice in API_STATUS_CHOICES:
|
|
||||||
if choice[0] == self.api_status:
|
|
||||||
return choice[1]
|
|
||||||
|
|
||||||
def in_corp(self, corpid):
|
def in_corp(self, corpid):
|
||||||
for char in self.characters.all():
|
for char in self.characters.all():
|
||||||
@@ -90,18 +85,6 @@ class EVEPlayerCharacter(EVEAPIModel):
|
|||||||
|
|
||||||
objects = EVEPlayerCharacterManager()
|
objects = EVEPlayerCharacterManager()
|
||||||
|
|
||||||
@property
|
|
||||||
def gender_description(self):
|
|
||||||
for choice in API_GENDER_CHOICES:
|
|
||||||
if choice[0] == self.gender:
|
|
||||||
return choice[1]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def race_description(self):
|
|
||||||
for choice in API_RACES_CHOICES:
|
|
||||||
if choice[0] == self.race:
|
|
||||||
return choice[1]
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
if self.name:
|
if self.name:
|
||||||
return "%s (%d)" % (self.name, self.id)
|
return "%s (%d)" % (self.name, self.id)
|
||||||
|
|||||||
4
fabfile.py
vendored
4
fabfile.py
vendored
@@ -5,8 +5,8 @@ env.repo = 'git://dev.dredd.it/dreddit-auth.git'
|
|||||||
|
|
||||||
def production():
|
def production():
|
||||||
"Use the production enviroment on Web1"
|
"Use the production enviroment on Web1"
|
||||||
env.hosts = ['matalok@web1.dredd.it']
|
env.hosts = ['dreddit@syndicate.tensixtyone.com']
|
||||||
env.path = '/home/matalok'
|
env.path = '/home/dreddit/apps'
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
"Use the test enviroment on Web2"
|
"Use the test enviroment on Web2"
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ def admin_applications(request):
|
|||||||
limit = request.get['l']
|
limit = request.get['l']
|
||||||
else:
|
else:
|
||||||
limit = 10
|
limit = 10
|
||||||
print query, limit
|
|
||||||
apps = Application.objects.filter(character__name__icontains=query)[:limit]
|
apps = Application.objects.filter(character__name__icontains=query)[:limit]
|
||||||
else:
|
else:
|
||||||
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class UpdateAPIs():
|
|||||||
def job(self):
|
def job(self):
|
||||||
delta = datetime.timedelta(seconds=self.last_update_delay)
|
delta = datetime.timedelta(seconds=self.last_update_delay)
|
||||||
|
|
||||||
print delta
|
|
||||||
self._logger.debug("Updating accounts older than %s" % (datetime.datetime.now() - delta))
|
self._logger.debug("Updating accounts older than %s" % (datetime.datetime.now() - delta))
|
||||||
|
|
||||||
for acc in RedditAccount.objects.filter(last_update__lt=(datetime.datetime.now() - delta)):
|
for acc in RedditAccount.objects.filter(last_update__lt=(datetime.datetime.now() - delta)):
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ from django.contrib.auth.models import User
|
|||||||
from reddit.models import RedditAccount
|
from reddit.models import RedditAccount
|
||||||
|
|
||||||
class RedditAccountForm(forms.ModelForm):
|
class RedditAccountForm(forms.ModelForm):
|
||||||
|
""" Basic Reddit account input form """
|
||||||
|
|
||||||
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
|
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
|
||||||
username = forms.CharField(label = u'Reddit Username', max_length=64)
|
username = forms.CharField(label = u'Reddit Username', max_length=64)
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class RedditAccount(models.Model):
|
|||||||
self.last_update = datetime.now()
|
self.last_update = datetime.now()
|
||||||
|
|
||||||
def recent_posts(self):
|
def recent_posts(self):
|
||||||
|
""" Returns the first page of posts visible on the user's profile page """
|
||||||
|
|
||||||
try:
|
try:
|
||||||
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username))
|
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username))
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ def UserServiceAccountForm(user):
|
|||||||
services = Service.objects.filter(groups__in=user.groups.all(),active=1).exclude(id__in=ServiceAccount.objects.filter(user=user).values('service')).distinct()
|
services = Service.objects.filter(groups__in=user.groups.all(),active=1).exclude(id__in=ServiceAccount.objects.filter(user=user).values('service')).distinct()
|
||||||
chars = EVEPlayerCharacter.objects.filter(eveaccount__user=user)
|
chars = EVEPlayerCharacter.objects.filter(eveaccount__user=user)
|
||||||
|
|
||||||
print len(services)
|
|
||||||
|
|
||||||
class ServiceAccountForm(forms.Form):
|
class ServiceAccountForm(forms.Form):
|
||||||
""" Service Account Form """
|
""" Service Account Form """
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,7 @@ class SSOUser(models.Model):
|
|||||||
# Generate the list of groups to add/remove
|
# Generate the list of groups to add/remove
|
||||||
delgroups = set(set(self.user.groups.all()) & set(corpgroups)) - set(chargroups)
|
delgroups = set(set(self.user.groups.all()) & set(corpgroups)) - set(chargroups)
|
||||||
addgroups = set(chargroups) - set(set(self.user.groups.all()) & set(corpgroups))
|
addgroups = set(chargroups) - set(set(self.user.groups.all()) & set(corpgroups))
|
||||||
|
|
||||||
print "Add: ", addgroups, "Del:", delgroups, "Current:", self.user.groups.all()
|
|
||||||
|
|
||||||
for g in delgroups:
|
for g in delgroups:
|
||||||
self.user.groups.remove(g)
|
self.user.groups.remove(g)
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Race: {{ character.race_description }}</li>
|
<li>Race: {{ character.get_race_display }}</li>
|
||||||
<li>Gender: {{ character.gender_description }}</li>
|
<li>Gender: {{ character.get_gender_display }}</li>
|
||||||
<li>Corporation: {{ character.corporation.name }}</li>
|
<li>Corporation: {{ character.corporation.name }}</li>
|
||||||
<li>Alliance: {{ character.corporation.alliance.name }}</li>
|
<li>Alliance: {{ character.corporation.alliance.name }}</li>
|
||||||
<li>Total SP: {{ character.total_sp|intcomma }}</li>
|
<li>Total SP: {{ character.total_sp|intcomma }}</li>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ setup.</p>
|
|||||||
<tr><td>{{ acc.api_user_id }}</td>
|
<tr><td>{{ acc.api_user_id }}</td>
|
||||||
<td>{{ acc.api_key }}</td>
|
<td>{{ acc.api_key }}</td>
|
||||||
<td>{{ acc.description }}</td>
|
<td>{{ acc.description }}</td>
|
||||||
<td>{{ acc.api_status_description }}</td>
|
<td>{{ acc.get_api_status_display }}</td>
|
||||||
<td>{{ acc.api_last_updated|naturaltimediff }}</td>
|
<td>{{ acc.api_last_updated|naturaltimediff }}</td>
|
||||||
<td><a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,
|
<td><a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,
|
||||||
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,
|
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,
|
||||||
|
|||||||
Reference in New Issue
Block a user