フォーラム

ホーム » Liferay Portal » English » A. Liferay's Community » General

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Nilesh Gundecha
Define permissions API for Organization Role not working
2012/04/18 0:31
答え

Nilesh Gundecha

ランク: Regular Member

投稿: 189

参加年月日: 2009/11/30

最近の投稿

I am using Liferay 6.1 and I have written below code for defining permissions for custom roles

 1
 2
 3                Role role = RoleLocalServiceUtil.fetchRole(companyId, RoleType.ORGANIZATION_MANAGER);
 4                int scope = ResourceConstants.SCOPE_GROUP_TEMPLATE;
 5            long roleId = role.getRoleId();
 6        long companyId = role.getCompanyId();
 7        String primKey = String.valueOf(companyId);
 8                String name = "com.liferay.portlet.blogs";
 9                String actionIds[] = new String[] {ActionKeys.ADD_ENTRY, ActionKeys.SUBSCRIBE};
10
11        try{
12            if (_PERMISSIONS_USER_CHECK_ALGORITHM == 6) {
13                ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, name, scope, primKey, roleId, actionIds);
14            }
15            else {
16                PermissionLocalServiceUtil.setRolePermissions(roleId, companyId, name, scope, primKey, actionIds);
17            }
18        }catch(Exception e){
19            e.printStackTrace();
20        }


This code does not throw any exception and when I navigate to Control Panel ==> Role Admin section, it shows that check box selected for the required permissions. But in actual, the permissions are not assigned. When I click on SAVE from Control Panel, then the permissions are getting assigned and it reflects in the portlets.

What am I doing wrong here? Any help please?

Regards,
Nilesh
Nilesh Gundecha
RE: Define permissions API for Organization Role not working
2012/04/19 4:03
答え

Nilesh Gundecha

ランク: Regular Member

投稿: 189

参加年月日: 2009/11/30

最近の投稿

Any help would be highly appreciated!

Regards,
Nilesh
Hitoshi Ozawa
RE: Define permissions API for Organization Role not working
2012/07/21 6:52
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿: 7954

参加年月日: 2010/03/23

最近の投稿

I think you'll get better replies if you post your question to the 3. Development forum instead of this forum which is about liferay.com site here.
Surodip Patra
RE: Define permissions API for Organization Role not working
2013/01/30 2:59
答え

Surodip Patra

ランク: Junior Member

投稿: 26

参加年月日: 2013/01/25

最近の投稿

Is there any solution found for this problem? I have the same problem. Can anyone help me please?

Thanks & Regards,
Surodip Patra