Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Files are not displayed in Media Gallery View modes: 
User avatar
Member
Member
Naresh - 5/24/2011 3:08:59 PM
   
Files are not displayed in Media Gallery
Hi!

We have a Custom Group registration web part which is used to create a group.
While the group is created it also creates 2 media libraries.

So, when a user creates a group, he is the group admin and he should be able to see all the media gallery files and also a group member should be able to view the files. But, in my case only the global administrator is able to view the Media gallery files. The group admin and group members where not able to see the files they uploaded or files uploaded by other group members.

Am not able to figure out the reason why they were not able to view those files, though the user is a group admin or group member. I also checked the security setting for Media library in Groups, but they didn't help.

Does any one have any idea about this issue.

Thank You,

Naresh

User avatar
Member
Member
kentico_michal - 5/26/2011 5:42:18 AM
   
RE:Files are not displayed in Media Gallery
Hi Naresh,

So, if I understand you correctly, you have modified the Group registration web part.

How do you create a new media library programatically. You can find example how to do this in the CreateGroupMediaLibrary method in the following file ~\CMSModules\Groups\Controls\GroupRegistration.ascx.cs. So could you please try to use this code?

Morever, what version of Kentico CMS you are using?

Best regards,
Michal Legen

User avatar
Member
Member
Naresh - 5/26/2011 6:52:40 PM
   
RE:Files are not displayed in Media Gallery
Hi Michal Legen,

Thank You for the reply.

We created a new custom web part for creating groups.
In the code-behind, after the group is successfully created, we are creating "Default Media Libraries".
Two media libraries are created "First Media Library for Documents" and "Second Media Library for Media". The Media library names are defined as, (for example "Documents_{GroupGUID}") in the DB. I am using a "Media Gallery" web part to upload and display the media gallery content. I created two media galleries in one page following Kentico documentation ("How to have two Media Gallery webparts within one page" in knowledge base). Everything works fine but, am not able to set the security for the media gallery content access.

Also, I checked the "~\CMSModules\Groups\Controls\GroupRegistration.ascx.cs" file for the Method "CreateGroupMediaLibrary". But, I didn't find any method with that name.

The Kentico Version we are using is "v5.5.4155"

So, could you please let me know where am doing mistake in assigning the security properties for media gallery.

Thank You,

Naresh

User avatar
Member
Member
kentico_michal - 5/30/2011 6:56:32 AM
   
RE:Files are not displayed in Media Gallery
Hello,

The CreateGroupMediaLibrary method was introduced in version 5.5 R2. Anyway, could you please try to use following code for creating a new media library:


MediaLibraryInfo mlInfo = new MediaLibraryInfo();
mlInfo.LibraryDisplayName = "DisplayName";
mlInfo.LibraryFolder = "LibraryFolder";
mlInfo.LibraryName = "codeName";
mlInfo.LibraryDescription = "";
mlInfo.LibraryGroupID = GroupInfo.GroupID;
mlInfo.LibrarySiteID = CMSContext.CurrentSiteID;

// Set security
mlInfo.FileCreate = SecurityAccessEnum.GroupMembers;
mlInfo.FileDelete = SecurityAccessEnum.GroupMembers;
mlInfo.FileModify = SecurityAccessEnum.GroupMembers;
mlInfo.FolderCreate = SecurityAccessEnum.GroupMembers;
mlInfo.FolderDelete = SecurityAccessEnum.GroupMembers;
mlInfo.FolderModify = SecurityAccessEnum.GroupMembers;
mlInfo.Access = SecurityAccessEnum.GroupMembers;

try
{
MediaLibraryInfoProvider.SetMediaLibraryInfo(mlInfo);
}
catch
{
return;
}



Best regards,
Michal Legen