privilege manager problem

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

Posts: 79
Joined: 08 Apr 2012, 09:04

privilege manager problem

Postby scofy » 16 May 2012, 07:10

When i set privilege activate , the addbuddy request was rejected.
My server version is sfs2x 2.0.1.

14:57:39,055 WARN [com.smartfoxserver.v2.controllers.SystemController-1] controllers.SystemController - System Request rejected: insufficient privileges. Request: AddBuddy, User: ( User Name: 10010, Id: 12, Priv: 0, Sess: )
User avatar
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: privilege manager problem

Postby rjgtav » 16 May 2012, 20:07

Hello. What SFS2X version are you using?
Please make sure that you have configured the privilegeManager correctly, and enabled the addBuddy request to the specific privilege level (remember that the actions you select on the privilege manager are actually the actions that are denied, not the ones that are allowed)
Finally, make sure that your user's privilege level is correctly set to a level which is able to add buddies.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
SFS Tutorials: - Discontinued. Some examples may be bugged.
User avatar
Posts: 13
Joined: 04 May 2016, 08:52

Re: privilege manager problem

Postby saibara » 23 May 2016, 08:49

Hi buddy,

I have same problem with you, I tried to following the docs. But that script doesn't work.
Users always have same privilege.

I made this script:

Code: Select all

public class LoginHandler extends BaseServerEventHandler{
    public void handleServerEvent(ISFSEvent event) throws SFSException
        Session session = (Session) event.getParameter(SFSEventParam.SESSION);
        String name = (String) event.getParameter(SFSEventParam.LOGIN_NAME);
        User user = (User) event.getParameter(SFSEventParam.USER);
        if(name.equals("larang") || name.equals("banned"))
            SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_USERNAME);
            throw new SFSLoginException("Anda dilarang masuk zone!",errData);
        if (name.equals("SuperUser") || name.equals("admin"))
            session.setProperty("$permission", DefaultPermissionProfile.MODERATOR);
        trace("loginhandler class readed");

even, "loginhandler class read" not show. Do you have any idea?
User avatar
Site Admin
Posts: 20049
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: privilege manager problem

Postby Lapo » 23 May 2016, 15:24

your code doesn't look right. In particular you're trying to obtain a "User" object in your login handler but there is no such parameter in the LOGIN event (check the docs for more).

The User object is only created after your Login event handler has completed and based on whether you have raised an SFSLoginException or not.
(So your code trying to access such User object will throw a NullPointerException)

As regards setting permissions the documentation is this: ... ge-manager

See the last section.

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 1 guest