2

In Calendar portlet "Add Event", we can set view permissions. But by default it is showing three options namely in "Viewable by" drop down, "Any One(Guest Role), Site Members and Owner". With these options i want to list name of all site members also....And when adding new event, if I selected a user, the event should be viewable by that particular user only...and if i selected "Site Members" it should be visible for all....

One solution i am thinking is by editing "edit_event.jsp". Created a hook for that...

The following code is giving the drop down of "Viewable by".... Here how can i add all site members name also? And will it check automatically hile showing events? Please help.....

 <c:if test="<%= event == null %>">
           <aui:field-wrapper label="permissions">
            <liferay-ui:input-permissions
              modelName="<%= CalEvent.class.getName() %>"
            />
            </aui:field-wrapper>
  </c:if>
7
  • Event Portlet? do you mean to say Calendar Portlet instead?
    – Prakash K
    Jan 8, 2013 at 9:39
  • Oh, Yes, Calendar portlet. Sorry for the mistake..
    – Boat
    Jan 8, 2013 at 10:31
  • <aui:select name="user"> <% for (User usr : UserLocalServiceUtil.getRoleUsers(10163)) { %> <aui:option label="<%=usr.getScreenName()%>" /> <% } %> </aui:select> This code will create a new drop down "User" and will populate all users in a role. But how to merge it with the code which is posted with the question to come all users in "Viewable By" drop down?
    – Boat
    Jan 8, 2013 at 13:05
  • The drop-down Viewable by lists some of the most common roles and not individual Users. And it uses liferay's <liferay-ui:input-permissions> tag as can be seen, so you would have to modify this tag with a hook which is not at all a good idea since it would also affect other portlets. Also this Viewable by is just the default which appears only when you ADD an event and it would not appear when you edit an event, as while editing you can change the permissions for this event to some other role. So you would have to go with some other approach.
    – Prakash K
    Jan 8, 2013 at 13:22
  • One thing I can think of is to map the Users to some Roles [with the same name as the User] i.e. for every User there would be a Role with the same name. Then somehow you can pass the userId to the backend and with a struts-action or wrapper hook or both, you can remove all the permissions for the Calendar event and assign the Role-with-username to the event. In this way liferay would automatically filter it based on permissions. This is what I can think of from the top of my mind, not yet thought of the pros & cons for this approach.
    – Prakash K
    Jan 8, 2013 at 13:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.