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": {
"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",

View file

@ -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:

View file

@ -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

View file

@ -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):

View file

@ -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:

View file

@ -82,7 +82,7 @@ pandora.ui.filesView = function(options, self) {
operator: '+',
title: 'Path',
visible: true,
width: 720
width: 480
},
{
align: 'left',
@ -194,7 +194,7 @@ pandora.ui.filesView = function(options, self) {
operator: '+',
title: 'Path',
visible: true,
width: 720
width: 480
},
],
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
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,
css = {
marginTop: '4px',
@ -30,7 +30,7 @@ pandora.ui.infoView = function(data) {
$info = $('<div>')
.css({
position: 'absolute',
left: canEditIcons && !ui.showIconBrowser ? -listWidth + 'px' : 0,
left: canEdit && !ui.showIconBrowser ? -listWidth + 'px' : 0,
top: 0,
right: 0,
})
@ -39,7 +39,7 @@ pandora.ui.infoView = function(data) {
$data = Ox.Container()
.css({
position: 'absolute',
left: (canEditIcons ? listWidth : 0) + 'px',
left: (canEdit ? listWidth : 0) + 'px',
top: 0,
right: 0,
height: pandora.$ui.contentPanel.size(1) + 'px'
@ -377,7 +377,7 @@ pandora.ui.infoView = function(data) {
)
.appendTo($statistics);
if (canEditIcons) {
if (canEdit) {
$icon.bindEvent({
doubleclick: function() {
pandora.UI.set('showIconBrowser', !ui.showIconBrowser);

View file

@ -108,7 +108,7 @@ pandora.ui.item = function() {
}
});
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
window.location.reload();
});