Examples of PermissionChecker


Examples of cn.com.manager.permission.checker.PermissionChecker

    static {
        resetPermission();
    }

    public static void resetPermission() {
        PermissionChecker permissionChecker = new PermissionChecker();
        permissionChecker.registerPermission(PermissionChecker._PERMISSION_ACTION, new ProgramPermission());
        permissionChecker.registerPermission(PermissionChecker._PERMISSION_SECRET, new SecretPermission());
        // TODO数据库填充
        _USER_PERMISSION_CHECKER.put("1", permissionChecker);

    }
View Full Code Here

Examples of com.Acrobot.ChestShop.Listeners.PreTransaction.PermissionChecker

            registerEvent(new AmountAndPriceChecker());
        }

        registerEvent(new CreativeModeIgnorer());
        registerEvent(new ErrorMessageSender());
        registerEvent(new PermissionChecker());
        registerEvent(new PriceValidator());
        registerEvent(new ShopValidator());
        registerEvent(new SpamClickProtector());
        registerEvent(new StockFittingChecker());
    }
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker =
      themeDisplay.getPermissionChecker();

    if (!permissionChecker.isCompanyAdmin()) {
      return;
    }

    long meetupsEntryId = ParamUtil.getLong(
      actionRequest, "meetupsEntryId");
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

      actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay)uploadRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker =
      themeDisplay.getPermissionChecker();

    if (!permissionChecker.isCompanyAdmin()) {
      return;
    }

    long meetupsEntryId = ParamUtil.getLong(
      uploadRequest, "meetupsEntryId");
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

  @Override
  protected Collection<UserData> getUsers() {

    try {
      final PermissionChecker oldChecker = PermissionThreadLocal.getPermissionChecker();
      try {
        PermissionThreadLocal.setPermissionChecker(new PermissionChecker() { //TODO not the best way to do it?
          @Override
          public long getCompanyId() {
            return oldChecker.getCompanyId();
          }

          @Override
          public long getOwnerRoleId() {
            return oldChecker.getOwnerRoleId();
          }

          @Override
          public long[] getRoleIds(long userId, long groupId) {
            return oldChecker.getRoleIds(userId, groupId);
          }

          @Override
          public long getUserId() {
            return oldChecker.getUserId();
          }

          @Override
          public boolean hasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId) {
            return true;
          }

          @Override
          public boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) {
            return true;
          }

          @Override
          public boolean hasPermission(long groupId, String name, long primKey, String actionId) {
            return true;
          }

          @Override
          public boolean hasPermission(long groupId, String name, String primKey, String actionId) {
            return true;
          }

          @Override
          public boolean hasUserPermission(long groupId, String name, String primKey, String actionId, boolean checkAdmin) {
            return true;
          }

          @Override
          public void init(User user, boolean checkGuest) {
            oldChecker.init(user, checkGuest);
          }

          @Override
          public boolean isCommunityAdmin(long groupId) {
            return true;
          }

          @Override
          public boolean isCommunityOwner(long groupId) {
            return true;
          }

          @Override
          public boolean isCompanyAdmin() {
            return true;
          }

          @Override
          public boolean isCompanyAdmin(long companyId) {
            return true;
          }

          @Override
          public boolean isOmniadmin() {
            return true;
          }

          @Override
          public void resetValues() {
            oldChecker.resetValues();
          }

          @Override
          public void setCheckGuest(boolean checkGuest) {
            oldChecker.setCheckGuest(true);
          }

          @Override
          public void setValues(PortletRequest portletRequest) {
            oldChecker.setValues(portletRequest);
          }
        });
        Role role = RoleServiceUtil.getRole(PortalUtil.getDefaultCompanyId(), liferayRoleName);
        if (role == null) return new HashSet<UserData>();
        long[] roleUserIds = UserServiceUtil.getRoleUserIds(role.getRoleId());
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

*/
public class SetupBrazilianRegionsStartupAction extends SimpleAction {

  public void run(String[] companyIds) throws ActionException {

    PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

    try {

      PermissionThreadLocal.setPermissionChecker(new OminAdminPermissionChecker());

View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

   *
   * @throws  SystemException
   * @throws  PortalException
   */
  protected void setupPermissionChecker(long companyId) throws PortalException, SystemException {
    PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

    if (permissionChecker == null) {
      Role administratorRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.ADMINISTRATOR);
      User administratorUser = UserLocalServiceUtil.getRoleUsers(administratorRole.getRoleId()).get(0);

View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

    }
  }

  public boolean userHasPortletPermission(String actionId) {
    ThemeDisplay themeDisplay = getThemeDisplay();
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
    String portletId = themeDisplay.getPortletDisplay().getId();
    boolean hasPermission = false;

    try {
      hasPermission = PortletPermissionUtil.contains(permissionChecker, themeDisplay.getPlid(), portletId,
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

  private static void updateExpandos(long companyId, Registrant registrant) throws PortalException, SystemException {

    // Set the expando column (custom field) values. Note that since the registration portlet is being used
    // by a "Guest" user, we have to trick the Liferay permissionChecker into thinking that the current
    // user is the Administrator user (someone who has the permission to set expando column values).
    PermissionChecker permissionCheckerBackup = PermissionThreadLocal.getPermissionChecker();
    PermissionThreadLocal.setPermissionChecker(getAdministratorPermissionChecker(companyId));

    ExpandoBridge expandoBridge = registrant.getExpandoBridge();
    expandoBridge.setAttribute(UserExpando.COMPANY_NAME.getName(), registrant.getCompanyName());
    expandoBridge.setAttribute(UserExpando.FAVORITE_COLOR.getName(), registrant.getFavoriteColor());
View Full Code Here

Examples of com.liferay.portal.security.permission.PermissionChecker

        phone.setNumber(mobilePhone);
        phone.setPrimary(true);
        phone.setTypeId(getMobilePhoneTypeId());
        phones.add(phone);

        PermissionChecker permissionCheckerBackup = PermissionThreadLocal.getPermissionChecker();
        PermissionThreadLocal.setPermissionChecker(getAdministratorPermissionChecker(companyId));

        // Note: Exception will be thrown if we don't set the PrinicpalThreadLocal name.
        String principalNameBackup = PrincipalThreadLocal.getName();
        PrincipalThreadLocal.setName(creatorUserId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.