Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Oriol Mesia
View Content - Permissions Problem
July 17, 2013 2:46 AM
Answer

Oriol Mesia

Rank: Junior Member

Posts: 64

Join Date: April 4, 2013

Recent Posts

Hi,

I'm working with the drools rule code examples posted in Liferay web page.

This rules read the web page content as follows (Java Code Part)....


function List getAssetEntries(
User user, long[] classNameIds, String recomendationId, String segment) {

List<String> JAIds = getValidIDs(user, recomendationId, segment);

List<Group> groups = user.getMySites();

long[] groupIds = new long[groups.size()];

for (int i = 0; i < groups.size(); i++) {
Group group = groups.get(i);

groupIds = group.getGroupId();
}

if ((classNameIds == null) || (classNameIds.length == 0) ||
(groupIds.length == 0)) {
return Collections.emptyList();
}
SearchContext searchContext = new SearchContext();

searchContext.setAttribute("paginationType", "regular");
searchContext.setCompanyId(user.getCompanyId());
searchContext.setGroupIds(groupIds);
searchContext.setIncludeStagingGroups(false);
searchContext.setScopeStrict(false);
searchContext.setUserId(user.getUserId());

List<AssetEntry> assetEntries = new ArrayList<AssetEntry>();
for (long classNameId : classNameIds) {
String className = PortalUtil.getClassName(classNameId);
Indexer indexer = IndexerRegistryUtil.getIndexer(className);
if (indexer == null) {
continue;
}

Hits hits = indexer.search(searchContext);
for (int i = 0; i < hits.getDocs().length; i++) { ..................


I create some web content from Admin user and content is displayed without problems to him but not to other Users.

What I should do or modify to allow other users to see that content.




Thank you,
Oriol
Anil Sunkari
RE: View Content - Permissions Problem
July 17, 2013 3:53 AM
Answer

Anil Sunkari

Rank: Expert

Posts: 412

Join Date: August 11, 2009

Recent Posts

Check the role mapping to user & content perspective. You can add custom roles also and map those roles to webcontent.

Regards,
Anil Sunkari
Oriol Mesia
RE: View Content - Permissions Problem
July 18, 2013 12:29 AM
Answer

Oriol Mesia

Rank: Junior Member

Posts: 64

Join Date: April 4, 2013

Recent Posts

I defined permissions for web content -> view in Users role but even this It doesn't functions...

And the contents of the portlet aren't displayed.
Anil Sunkari
RE: View Content - Permissions Problem
July 19, 2013 5:08 AM
Answer

Anil Sunkari

Rank: Expert

Posts: 412

Join Date: August 11, 2009

Recent Posts

i Believe Users role got assigned to those respective users. If not please assign.

Regards,
Anil Sunkari
Oriol Mesia
RE: View Content - Permissions Problem
July 31, 2013 3:19 AM
Answer

Oriol Mesia

Rank: Junior Member

Posts: 64

Join Date: April 4, 2013

Recent Posts

Anil Sunkari:
i Believe Users role got assigned to those respective users. If not please assign.

Regards,
Anil Sunkari



The easy solution I did it was to comment this line:

//searchContext.setGroupIds(groupIds);

And stop filtering by groupIds.



Thank you for your help Anil,
Oriol