User for media update, does not update layout

Asked by Bert Bekkema

Hi there,

I have the same question as in https://answers.launchpad.net/xibo/+question/229585, but want the user to get as less rights as possible.

As xibo_admin I created a user and a group. Added the user as member into the group. The group has the following rights:
View + Edit - On a Video object
View + Edit - On a Layout
View + Edit - On a region in the same Layout
View + Edit - On the timeline object which is associated to the Video object.

When I Edit the video (as user) from the timeline and upload another video, click Save, then the following message appears:
"Media you own already had this name. Please choose another."
http://i.imgur.com/f3DNa3H.png

When I Edit the video (as user) from the library and upload another video, and the "Update this media in all layouts it is assigned to..." checkbox is checked, the video is edited. The ID is changed. But the layout is not updated.
http://i.imgur.com/zI78JAk.png

Logging tells me:
5351 2014-12-03 10:37:43 module ReplaceMediaInAllLayouts Replacing mediaid 28 with mediaid 29 in all layouts
5353 2014-12-03 10:37:43 module ReplaceMediaInAllLayouts Replaced media in 0 layouts
http://i.imgur.com/5vUyju9.png

The media using in the layout is still using media ID: 19 (!!)

Is there a way to get this working?

PS.
Also the user has to much rights, but is also to exclude there are not enough rights. The only thing a user may have to do is update the video. This means View + Edit rights on the media object and only Edit rights on the timeline object (and maybe the region and/or layout).

Question information

Language:
English Edit question
Status:
Answered
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bert Bekkema (e-bekkema) said :
#1

Small update:

When the User has View + Edit rights on the Layout, and let it create a new region, edit the timeline and add the video from the library, then the User can update the video from the library !!

After changing the rights on the Layout to Edit-only, then the video can be updated, but is the ID is not updated in the ID of the timeline. Changing back to View + Edit on the Layout does not solve the problem because the ID's are out of sync.

Example:
- The user creates a new region and add a video file with ID 1 out of the library.
- Then the user updates the video in the library. The ID changes to 2 and the also the layout is updated: Replaced media in 1 layouts
- Removed the View from the Layout.
- Then the user updates the video in the library. The ID changes to 3, but the layout is not updated: Replaced media in 0 layouts
- Given back the View rights.
- The User updates the video in the library. The ID changes to 4, but the layout is still not updated. This is because ID 3 is updated to 4 and the layout has still ID 2 !! Even as an administrator the video cannot be updated.

Revision history for this message
Bert Bekkema (e-bekkema) said :
#2

Another small update... and it's getting stranger

When giving the User only View rights on the Layout, then the video is also updated !!

Looks like the option:
"Update this media in all layouts it is assigned to. Note: It will only be replaced in layouts you have permission to edit."
is also (and only) working when the View right is set on the Layout.

Using: Version 1.6.4

Revision history for this message
Dan Garner (dangarner) said :
#3

Hi Bert,

thank you for the detailed analysis.

As you have noted - once they get out of sync you are effectively doomed because the layout will still have the old media ID, which has been edited and replaced. The UI probably shouldn't allow you to edit that version - rather it should say "Replace with latest version" or something like that. Once the latest version is on there it could then allow the edit again.

As for the view being set - that is a very real possibility and quite a tricky problem. Because View permissions are not set the code will automatically exclude those layouts from the "view" that is returned when the software asks "what layouts does this user have permission to view".

We can prove this if you are willing to edit a file:

/modules/module_user_general.php
Line 1112

Replace:
if ($auth->view)

With:
if ($auth->view || $auth->edit || $auth->del)

Revision history for this message
Bert Bekkema (e-bekkema) said :
#4

Hello Dan,

Thank you for responding.

I'm not sure what this test will prove. Sorry for that :)

The only right the user has on the Layout is View rights. The user can see the layout in the list.
The user does not have the possibility to edit or remove the layout.
http://i.imgur.com/nRy6NUs.png

When I remove the View right for this user (group) on the Layout, then it is not possible to update the underlying movie-ID, in the region, anymore.

I'm willing to make the change in the script, though. But want to know what this proves.

Thanks,
Bert

Revision history for this message
Dan Garner (dangarner) said :
#5

Hi Bert,

You said:

Looks like the option:
"Update this media in all layouts it is assigned to. Note: It will only be replaced in layouts you have permission to edit."
is also (and only) working when the View right is set on the Layout.

The suggested patch "fixes" this bit: "is also (and only) working when the View right is set on the Layout".

Revision history for this message
Bert Bekkema (e-bekkema) said :
#6

Hello Dan,

On line 1112, I do not have "if ($auth->view)". And I'm guessing the closest one (on line 1109) is not the one that should be edited.

Explaining picture: http://i.imgur.com/IaVsfXy.png

Revision history for this message
Dan Garner (dangarner) said :
#7

Yup, exactly so!

Can you help with this problem?

Provide an answer of your own, or ask Bert Bekkema for more information if necessary.

To post a message you must log in.