Skip to content

Instantly share code, notes, and snippets.

View jverweijL's full-sized avatar
💭
🏴‍☠️

Jan Verweij jverweijL

💭
🏴‍☠️
View GitHub Profile
@jverweijL
jverweijL / setup elasticsearch.md
Last active November 15, 2019 08:53
quickly setup elk stack for liferay 7.2 on ubuntu

Install Elastic 7.4

cd /tmp
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-amd64.deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-amd64.deb.sha512
shasum -a 512 -c elasticsearch-7.4.2-amd64.deb.sha512 
sudo dpkg -i elasticsearch-7.4.2-amd64.deb

Install required plugins

@jverweijL
jverweijL / brokenlinks.js
Last active November 8, 2019 07:55
detect brokenlinks
@jverweijL
jverweijL / howto.md
Last active July 16, 2024 09:25
Overriding Liferay 7 portal-log4j.xml

While trying to create a poorman's auditing system with Liferay 7 I ran into some challenges. So to prevent you make the same mistakes you can learn from my mistakes.

First you need to create a portal-log4j-ext.xml that will be used to override portal-log4j.xml Mine looks like this but yours might be totally different:

<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
{
"availableLanguageIds": [
"en_US"
],
"defaultLanguageId": "en_US",
"fields": [
{
"label": {
"en_US": "Url"
},

A quick summary of https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/using-resources-and-permissions

Important

To see the security settings for the service you MUST have a portlet reference. If you don't have a portlet just yet try to refer to an existing one like com_liferay_blogs_web_portlet_BlogsPortlet

Define portlet.properties

Create a file portlet.properties in .../[project]-service/src/main/resources/ Add resource.actions.configs=META-INF/resource-actions/default.xml in the file.

Declare resources and their permissions in default.xml

<#--
Web content templates are used to lay out the fields defined in a web
content structure.
Please use the left panel to quickly add commonly used variables.
Autocomplete is also available and can be invoked by typing "${".
-->
<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") />
<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
<#if entries?has_content>
<#list entries as curEntry>
<#assign renderer = curEntry.getAssetRenderer() />
<#assign journalArticle = renderer.getArticle() />
<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") />
<#assign categories = AssetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", journalArticle.getResourcePrimKey()) />
<#if categories?has_content>
<#list categories as category>
${category.getName()}
@jverweijL
jverweijL / install.sh
Last active July 15, 2019 06:52
Some basic components to install/configure for demo server
#noip
sudo apt-get update
sudo apt-get install build-essential
cd /usr/local/src
sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
sudo tar xzf noip-duc-linux.tar.gz
cd noip-2*
sudo make install
sudo su