Examples of PermissionDeniedException


Examples of com.forgeessentials.core.commands.PermissionDeniedException

            // parse ./auth kick
            if (args[0].equalsIgnoreCase("kick"))
            {
                if (!hasAdmin)
                {
                    throw new PermissionDeniedException();
                }
                else if (!isLogged)
                {
                    throw new PlayerNotFoundException();
                }
                else
                {
                    ModuleAuth.hasSession.remove(name);
                    OutputHandler.chatConfirmation(sender, String.format("Player %s was logged out from the authentication service.", name));
                    OutputHandler.chatWarning(player, "You have been logged out from the authentication service. Please login again.");
                    return;
                }
            }
            // parse ./auth setpass
            else if (args[0].equalsIgnoreCase("setPass"))
            {
                if (!hasAdmin)
                {
                    throw new PermissionDeniedException();
                }

                throw new WrongUsageException("/auth setpass <player> <password>");
            }

            // parse ./auth unregister
            else if (args[0].equalsIgnoreCase("unregister"))
            {
                if (!hasAdmin)
                {
                    throw new PermissionDeniedException();
                }

                if (PlayerPassData.getData(name) == null)
                {
                    throw new WrongUsageException(String.format("Player %s is not registered!", name));
                }

                PlayerPassData.deleteData(name);
                OutputHandler.chatConfirmation(sender, String.format("Player %s has been removed from the authentication service.", name));
                return;
            }

            // ERROR! :D
            else
            {
                throw new WrongUsageException("/auth help");
            }
        }
        // 3 args? must be a comtmand - player - pass
        else if (args.length == 3)
        {
            if (!ModuleAuth.hasSession.contains(sender.getPersistentID()))
            {
                OutputHandler.chatError(sender, "Login required. Try /auth help.");
                return;
            }

            // parse changePass
            if (args[0].equalsIgnoreCase("changepass"))
            {
                UUID name = sender.getPersistentID();
                PlayerPassData data = PlayerPassData.getData(name);

                if (data == null)
                {
                    throw new WrongUsageException(String.format("Player %s is not registered!", name));
                }
                String oldpass = ModuleAuth.encrypt(args[1]);
                String newPass = ModuleAuth.encrypt(args[2]);

                if (args[1].equals(args[2]))
                {
                    OutputHandler.chatConfirmation(sender, "You can't use this new password - it's the same as what was previously there.");
                    return;
                }

                if (!data.password.equals(oldpass))
                {
                    OutputHandler.chatConfirmation(sender, "Could not change the password - your old password is wrong");
                    return;
                }

                data.password = newPass;
                data.save();

                OutputHandler.chatConfirmation(sender, "Password change successful.");
                return;

            }

            // check for players.. all the rest of these should be greated than 1.
            UUID name = UserIdent.getUuidByUsername(args[1]);
            // check if the player is logged.
            EntityPlayerMP player = UserIdent.getPlayerByMatchOrUsername(sender, args[1]);
            if (player == null)
            {
                OutputHandler.chatWarning(sender, "A player of that name is not on the server. Doing the action anyways.");
            }

            // pasre setPass
            if (args[0].equalsIgnoreCase("setPass"))
            {
                if (!hasAdmin)
                {
                    throw new PermissionDeniedException();
                }

                PlayerPassData data = PlayerPassData.getData(name);
                String encrypted = ModuleAuth.encrypt(args[2]);
View Full Code Here

Examples of com.google.gerrit.common.errors.PermissionDeniedException

  public BanCommitResult ban(final ProjectControl projectControl,
      final List<ObjectId> commitsToBan, final String reason)
      throws PermissionDeniedException, IOException,
      InterruptedException, MergeException {
    if (!projectControl.isOwner()) {
      throw new PermissionDeniedException(
          "No project owner: not permitted to ban commits");
    }

    final BanCommitResult result = new BanCommitResult();
View Full Code Here

Examples of com.google.walkaround.util.server.servlet.PermissionDeniedException

    if (checkA && checkB) {
      log.info("Store access permitted");
      return;
    } else {
      throw new PermissionDeniedException("No store access");
    }
  }
View Full Code Here

Examples of com.mjs_svc.possibility.exceptions.PermissionDeniedException

    public static Employee createEmployee(String username, String firstname,
            String lastname, String email, Position p)
            throws PermissionDeniedException {
        // Check permissions
        if (!UserContainer.getUser().hasPermission("create_employee")) {
            throw new PermissionDeniedException();
        }

        ResourceBundle rb = ResourceBundle.getBundle(
                "FieldTitles", Locale.getDefault());
View Full Code Here

Examples of com.mjs_svc.possibility.exceptions.PermissionDeniedException

    public static Employee updateEmployee(int id, String username, String firstname,
            String lastname, String email, Position p)
            throws PermissionDeniedException {
        // Check permissions
        if (!UserContainer.getUser().hasPermission("change_employee")) {
            throw new PermissionDeniedException();
        }

        Session sess = HibernateUtil.getSessionFactory().getCurrentSession();
        sess.beginTransaction();
View Full Code Here

Examples of com.sshtools.daemon.platform.PermissionDeniedException

                } else {
                    throw new IOException(translateNFSPath(path) +
                        " is a directory, use remove directory command to remove");
                }
            } catch (SecurityException se) {
                throw new PermissionDeniedException("Permission denied");
            }
        } else {
            throw new FileNotFoundException(translateNFSPath(path) +
                " does not exist");
        }
View Full Code Here

Examples of cu.ftpd.filesystem.permissions.PermissionDeniedException

        } else {
            // nlst the pwd
            dir = pwdFile;
        }
        if (!ServiceManager.getServices().getPermissions().hasPermission(ActionPermission.LIST, resolvePath(dir), user)) {
            throw new PermissionDeniedException(ActionPermission.LIST, resolvePath(dir), user);
        }
        if (dir.exists() && dir.isDirectory()) {
            File[] files = dir.listFiles(forbiddenFiles);
            List<String> listOfFiles = new LinkedList<>();
            if (files != null && pwdFile.exists()) {
View Full Code Here

Examples of edu.stanford.bmir.protege.web.shared.permissions.PermissionDeniedException

        RequestValidator<A> validator = actionHandler.getRequestValidator(action, requestContext);
        if (validator instanceof UserHasProjectWritePermissionValidator) {
            // Temp fix for permission problem
            RequestValidationResult validationResult = validator.validateAction(action, requestContext);
            if(!validationResult.isValid()) {
                throw new PermissionDeniedException(validationResult.getInvalidMessage());
            }
        }
        R result = actionHandler.execute(action, executionContext);
        return new DispatchServiceResultContainer(result);
    }
View Full Code Here

Examples of logisticspipes.commands.exception.PermissionDeniedException

      return;
    } else {
      for(ICommandHandler handler:subCommands) {
        if(Arrays.asList(handler.getNames()).contains(command)) {
          if(!handler.isCommandUsableBy(sender)) {
            throw new PermissionDeniedException();
          }
          String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
          handler.executeCommand(sender, newArgs);
          return;
        }
View Full Code Here

Examples of org.drools.task.service.PermissionDeniedException

    assertEquals(Status.Ready, taskSummary.getStatus());

    System.out.println("Claiming task " + taskSummary.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
    getClient().claim(taskSummary.getId(), "Darth Vader", operationResponseHandler);
    PermissionDeniedException denied = null;
    try {
      operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    } catch (PermissionDeniedException e) {
      denied = e;
    }
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.