charactes are not people, fix changing password

This commit is contained in:
j 2011-10-22 22:12:56 +00:00
parent 96a0744309
commit ea52870db6
8 changed files with 18 additions and 14 deletions

View file

@ -14,7 +14,7 @@
*/ */
"capabilities": { "capabilities": {
"canDeleteItems": {"admin": true}, "canDeleteItems": {"admin": true},
"canEditItemIcons": {"staff": true, "admin": true}, "canEditMetadata": {"staff": true, "admin": true},
"canPlayClips": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4}, "canPlayClips": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4},
"canPlayVideo": {"guest": 1, "member": 1, "friend": 3, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 1, "member": 1, "friend": 3, "staff": 4, "admin": 4},
"canReloadMetadata": {"staff": true, "admin": true}, "canReloadMetadata": {"staff": true, "admin": true},
@ -196,7 +196,7 @@
"type": ["string"], "type": ["string"],
"autocomplete": true, "autocomplete": true,
"find": true, "find": true,
"sort": "person" "sort": "string"
}, },
{ {
"id": "name", "id": "name",

View file

@ -281,7 +281,7 @@ class File(models.Model):
'videoCodec': self.video_codec, 'videoCodec': self.video_codec,
'wanted': self.wanted, '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: if keys:
for k in data.keys(): for k in data.keys():
if k not in keys: if k not in keys:

View file

@ -190,7 +190,8 @@ class Item(models.Model):
def editable(self, user): def editable(self, user):
if user.is_anonymous(): if user.is_anonymous():
return False return False
if user.is_staff or \ if user.get_profile().capability('canEditMetadata') == True or \
user.is_staff or \
self.user == user or \ self.user == user or \
self.groups.filter(id__in=user.groups.all()).count() > 0: self.groups.filter(id__in=user.groups.all()).count() > 0:
return True return True

View file

@ -426,7 +426,7 @@ actions.register(getItem)
@login_required_json @login_required_json
def editItem(request): def edit(request):
''' '''
param data { param data {
id: string, id: string,
@ -445,11 +445,14 @@ def editItem(request):
if request.user.get_profile().capability('canSeeNotes'): if request.user.get_profile().capability('canSeeNotes'):
item.notes = data['notes'] item.notes = data['notes']
del data['notes'] del data['notes']
if 'rightsLevel' in data:
item.level = data['rightsLevel']
del data['rightsLevel']
item.edit(data) item.edit(data)
else: else:
response = json_response(status=403, text='permissino denied') response = json_response(status=403, text='permissino denied')
return render_to_json_response(response) return render_to_json_response(response)
actions.register(editItem, cache=False) actions.register(edit, cache=False)
@login_required_json @login_required_json
def remove(request): def remove(request):

View file

@ -584,7 +584,7 @@ def editPreferences(request):
request.user.email = data['email'] request.user.email = data['email']
if 'password' in data: if 'password' in data:
change = True change = True
request.user.password = data['password'] request.user.set_password(data['password'])
if change: if change:
request.user.save() request.user.save()
if errors: if errors:

View file

@ -82,7 +82,7 @@ pandora.ui.filesView = function(options, self) {
operator: '+', operator: '+',
title: 'Path', title: 'Path',
visible: true, visible: true,
width: 720 width: 480
}, },
{ {
align: 'left', align: 'left',
@ -194,7 +194,7 @@ pandora.ui.filesView = function(options, self) {
operator: '+', operator: '+',
title: 'Path', title: 'Path',
visible: true, visible: true,
width: 720 width: 480
}, },
], ],
columnsMovable: true, columnsMovable: true,

View file

@ -4,7 +4,7 @@ pandora.ui.infoView = function(data) {
// when collapsing the movies browser, the info view should become a split panel // when collapsing the movies browser, the info view should become a split panel
var ui = pandora.user.ui, var ui = pandora.user.ui,
canEditIcons = pandora.site.capabilities.canEditItemIcons[pandora.user.level], canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level],
borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8, borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8,
css = { css = {
marginTop: '4px', marginTop: '4px',
@ -30,7 +30,7 @@ pandora.ui.infoView = function(data) {
$info = $('<div>') $info = $('<div>')
.css({ .css({
position: 'absolute', position: 'absolute',
left: canEditIcons && !ui.showIconBrowser ? -listWidth + 'px' : 0, left: canEdit && !ui.showIconBrowser ? -listWidth + 'px' : 0,
top: 0, top: 0,
right: 0, right: 0,
}) })
@ -39,7 +39,7 @@ pandora.ui.infoView = function(data) {
$data = Ox.Container() $data = Ox.Container()
.css({ .css({
position: 'absolute', position: 'absolute',
left: (canEditIcons ? listWidth : 0) + 'px', left: (canEdit ? listWidth : 0) + 'px',
top: 0, top: 0,
right: 0, right: 0,
height: pandora.$ui.contentPanel.size(1) + 'px' height: pandora.$ui.contentPanel.size(1) + 'px'
@ -377,7 +377,7 @@ pandora.ui.infoView = function(data) {
) )
.appendTo($statistics); .appendTo($statistics);
if (canEditIcons) { if (canEdit) {
$icon.bindEvent({ $icon.bindEvent({
doubleclick: function() { doubleclick: function() {
pandora.UI.set('showIconBrowser', !ui.showIconBrowser); pandora.UI.set('showIconBrowser', !ui.showIconBrowser);

View file

@ -108,7 +108,7 @@ pandora.ui.item = function() {
} }
}); });
if(changed) { if(changed) {
pandora.api.editItem(Ox.extend(changed, {id: pandora.user.ui.item}), function(result) { pandora.api.edit(Ox.extend(changed, {id: pandora.user.ui.item}), function(result) {
//fixme just reload parts that need reloading //fixme just reload parts that need reloading
window.location.reload(); window.location.reload();
}); });