Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in the code for permissions #551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ Follow these steps to create the `GuestbookAssetRendererFactory`:
public static final String CLASS_NAME = Guestbook.class.getName();
public static final String TYPE = "guestbook";
private Logger logger = Logger.getLogger(this.getClass().getName());
@Reference(target = "(model.class.name=com.liferay.docs.guestbook.model.Guestbook)")
private ModelResourcePermission<Guestbook> _guestbookModelResourcePermission;
}
```
Expand Down Expand Up @@ -336,16 +337,14 @@ Follow these steps to create the `GuestbookAssetRendererFactory`:
}
```

3. Implement the `hasPermission` method via the `GuestbookPermission` class:
3. Implement the `hasPermission` method:

```java
@Override
public boolean hasPermission(PermissionChecker permissionChecker,
long classPK, String actionId) throws Exception {

Guestbook guestbook = _guestbookLocalService.getGuestbook(classPK);
long groupId = guestbook.getGroupId();
return GuestbookPermission.contains(permissionChecker, groupId,
return _guestbookModelResourcePermission.contains(permissionChecker, guestbook.getGuestbookId(),
actionId);
}
```
Expand Down