charactes are not people, fix changing password
This commit is contained in:
parent
96a0744309
commit
ea52870db6
8 changed files with 18 additions and 14 deletions
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
"capabilities": {
|
||||
"canDeleteItems": {"admin": true},
|
||||
"canEditItemIcons": {"staff": true, "admin": true},
|
||||
"canEditMetadata": {"staff": true, "admin": true},
|
||||
"canPlayClips": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4},
|
||||
"canPlayVideo": {"guest": 1, "member": 1, "friend": 3, "staff": 4, "admin": 4},
|
||||
"canReloadMetadata": {"staff": true, "admin": true},
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
"type": ["string"],
|
||||
"autocomplete": true,
|
||||
"find": true,
|
||||
"sort": "person"
|
||||
"sort": "string"
|
||||
},
|
||||
{
|
||||
"id": "name",
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ class File(models.Model):
|
|||
'videoCodec': self.video_codec,
|
||||
'wanted': self.wanted,
|
||||
}
|
||||
data['users'] = [i['user'] for i in data['instances']]
|
||||
data['users'] = list(set([i['user'] for i in data['instances']]))
|
||||
if keys:
|
||||
for k in data.keys():
|
||||
if k not in keys:
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@ class Item(models.Model):
|
|||
def editable(self, user):
|
||||
if user.is_anonymous():
|
||||
return False
|
||||
if user.is_staff or \
|
||||
if user.get_profile().capability('canEditMetadata') == True or \
|
||||
user.is_staff or \
|
||||
self.user == user or \
|
||||
self.groups.filter(id__in=user.groups.all()).count() > 0:
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ actions.register(getItem)
|
|||
|
||||
|
||||
@login_required_json
|
||||
def editItem(request):
|
||||
def edit(request):
|
||||
'''
|
||||
param data {
|
||||
id: string,
|
||||
|
|
@ -445,11 +445,14 @@ def editItem(request):
|
|||
if request.user.get_profile().capability('canSeeNotes'):
|
||||
item.notes = data['notes']
|
||||
del data['notes']
|
||||
if 'rightsLevel' in data:
|
||||
item.level = data['rightsLevel']
|
||||
del data['rightsLevel']
|
||||
item.edit(data)
|
||||
else:
|
||||
response = json_response(status=403, text='permissino denied')
|
||||
return render_to_json_response(response)
|
||||
actions.register(editItem, cache=False)
|
||||
actions.register(edit, cache=False)
|
||||
|
||||
@login_required_json
|
||||
def remove(request):
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ def editPreferences(request):
|
|||
request.user.email = data['email']
|
||||
if 'password' in data:
|
||||
change = True
|
||||
request.user.password = data['password']
|
||||
request.user.set_password(data['password'])
|
||||
if change:
|
||||
request.user.save()
|
||||
if errors:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue