This paper investigates the physical-layer security of a multiuser peer-to-peer (MUP2P) relay network for amplify-and-forward (AF) protocol, where a secure user and other unclassified users coexist with a multi-antenna eavesdropper and the eavesdropper can wiretap the confidential information in both two cooperative phases. Our goal is to optimize the transmit power of the source and the beamforming weights of the relays jointly for secrecy rate maximization subject to the minimum signal-to-interference-noise-ratio (SINR) constraint at each user, and the individual and total power constraints. Mathematically, the optimization problem is non-linear and non-convex, which does not facilitate an efficient resource allocation algorithm design. As an alternative, a null space beamforming scheme is adopted at the relays for simplifying the joint optimization and eliminating the confidential information leakage in the second cooperative phase, where the relay beamforming vector lies in the null space of the equivalent channel of the relay to eavesdropper links. Although the null space beamforming scheme simplifies the design of resource allocation algorithm, the considered problem is still non-convex and obtaining the global optimum is very difficult, if not impossible. Employing a sequential parametric convex approximation (SPCA) method, we propose an iterative algorithm to obtain an efficient solution of the non-convex problem. Besides, the proposed joint design algorithm requires a feasible starting point, we also propose a low complexity feasible initial points searching algorithm. Simulations demonstrate the validity of the proposed strategy.