Hi,
I try to implement entry for SO Sentry in table Userpreference to set restriction for some SO fields for certein User group in SO Online.
NSPreferenceAgent myUPAgent;
NSPreference myUP = myUPAgent.CreateDefaultPreference();
NSPreferenceSpec mySpec;
mySpec.SetSection("Rights-sale");
mySpec.SetKey("Sale.earning_percent");
myUP.SetSpecification(mySpec);
myUP.SetLevel(4); // set level to 4 for restriction for User group
myUP.SetDisplayType(0);
myUP.SetDisplayTooltip("Some User cannot read this field!");
myUPAgent.SavePreference(myUP);
Integer upID = myUP.GetUserPreferenceId();
But the id of Entry "upID" is still 0 after it's saved, and If I retrive the table, the deflevel is still 5 for single user, the prefvalue is still null, only prefsection and prefkey are correctly saved.
Then I try to update the entry via SerachEngine, like:
SearchEngine se;
se.addData("UserPreference.deflevel", "4"); // set level to 4 for restriction for User group
se.addData("UserPreference.owner_id", "9"); // user group id = 9
se.addData("UserPreference.prefvalue", "0,Some User cannot read this field");
se.addCriteria("UserPreference.userpreference_id", "OperatorEquals", "778", "OperatorAnd", 0);
se.update();
Now I got the entry 778 I want in th table userpreference, but after re-Login of the user from User Group 9, he can still read and edit this field "Sale.earning_percent".
does the sentry-Entries in table Userpreference really work for SO Online? Thanks!