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: 127.0.0.1:49689 )
privilege manager problem
Re: privilege manager problem
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.
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#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: privilege manager problem
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:
even, "loginhandler class read" not show. Do you have any idea?
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{
@Override
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);
errData.addParameter(name);
throw new SFSLoginException("Anda dilarang masuk zone!",errData);
}
if (name.equals("SuperUser") || name.equals("admin"))
{
user.setPrivilegeId((short)3);
session.setProperty("$permission", DefaultPermissionProfile.MODERATOR);
}
trace("loginhandler class readed");
}
}
even, "loginhandler class read" not show. Do you have any idea?
Re: privilege manager problem
Hi,
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:
http://docs2x.smartfoxserver.com/Advanc ... ge-manager
See the last section.
Thanks
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:
http://docs2x.smartfoxserver.com/Advanc ... ge-manager
See the last section.
Thanks
Return to “SFS2X iPhone / iPad / OSX API”
Who is online
Users browsing this forum: No registered users and 52 guests