first stage of transitioning to the new SecurityMonitor-based security
architecture--it's implemented at the global level and for communities, conferences still use the old hard-coded implementation. The new StaticSecurityMonitor is configured via XML data, which will be important when we implement the new Community Services architecture
This commit is contained in:
@@ -61,14 +61,14 @@ public class CommunityAdmin extends VeniceServlet
|
||||
|
||||
} // end makeCommunityAdminTop
|
||||
|
||||
private EditCommunityProfileDialog makeEditCommunityProfileDialog() throws ServletException
|
||||
private EditCommunityProfileDialog makeEditCommunityProfileDialog(SecurityInfo sinf) throws ServletException
|
||||
{
|
||||
final String desired_name = "EditCommunityProfileDialog";
|
||||
DialogCache cache = DialogCache.getDialogCache(getServletContext());
|
||||
|
||||
if (!(cache.isCached(desired_name)))
|
||||
{ // create a template and save it off
|
||||
EditCommunityProfileDialog template = new EditCommunityProfileDialog();
|
||||
EditCommunityProfileDialog template = new EditCommunityProfileDialog(sinf);
|
||||
cache.saveTemplate(template);
|
||||
|
||||
} // end if
|
||||
@@ -126,7 +126,7 @@ public class CommunityAdmin extends VeniceServlet
|
||||
} // end if
|
||||
|
||||
// construct the edit profile dialog and load it up for use
|
||||
EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog();
|
||||
EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog(comm.getSecurityInfo());
|
||||
|
||||
try
|
||||
{ // load the values for this dialog
|
||||
@@ -393,7 +393,7 @@ public class CommunityAdmin extends VeniceServlet
|
||||
} // end if
|
||||
|
||||
// construct the edit profile dialog and load it up for use
|
||||
EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog();
|
||||
EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog(comm.getSecurityInfo());
|
||||
dlg.setupDialogBasic(engine,comm);
|
||||
|
||||
if (dlg.isButtonClicked(request,"cancel"))
|
||||
|
||||
@@ -75,14 +75,14 @@ public class SystemAdmin extends VeniceServlet
|
||||
|
||||
} // end makeAdminModifyUserDialog
|
||||
|
||||
private EditGlobalPropertiesDialog makeGlobalPropertiesDialog() throws ServletException
|
||||
private EditGlobalPropertiesDialog makeGlobalPropertiesDialog(SecurityInfo sinf) throws ServletException
|
||||
{
|
||||
final String desired_name = "EditGlobalPropertiesDialog";
|
||||
DialogCache cache = DialogCache.getDialogCache(getServletContext());
|
||||
|
||||
if (!(cache.isCached(desired_name)))
|
||||
{ // create a template and save it off
|
||||
EditGlobalPropertiesDialog template = new EditGlobalPropertiesDialog();
|
||||
EditGlobalPropertiesDialog template = new EditGlobalPropertiesDialog(sinf);
|
||||
cache.saveTemplate(template);
|
||||
|
||||
} // end if
|
||||
@@ -186,7 +186,7 @@ public class SystemAdmin extends VeniceServlet
|
||||
AdminUserContext admuser = adm.getUserContext(Integer.parseInt(s_uid));
|
||||
|
||||
AdminModifyUserDialog dlg = makeAdminModifyUserDialog();
|
||||
dlg.setupDialog(adm.isGlobalAdmin(),admuser);
|
||||
dlg.setupDialog(adm,admuser);
|
||||
setMyLocation(request,"sysadmin?cmd=UM");
|
||||
return dlg;
|
||||
|
||||
@@ -215,7 +215,7 @@ public class SystemAdmin extends VeniceServlet
|
||||
try
|
||||
{ // get the global properties
|
||||
AdminOperations adm = user.getAdminInterface();
|
||||
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog();
|
||||
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog(adm.getSecurityInfo());
|
||||
dlg.setupDialog(adm);
|
||||
setMyLocation(request,"sysadmin?cmd=G");
|
||||
return dlg;
|
||||
@@ -301,7 +301,7 @@ public class SystemAdmin extends VeniceServlet
|
||||
} // end try
|
||||
catch (ValidationException ve)
|
||||
{ // this is a simple error
|
||||
dlg.resetOnError(adm.isGlobalAdmin(),admuser,ve.getMessage() + " Please try again.");
|
||||
dlg.resetOnError(adm,admuser,ve.getMessage() + " Please try again.");
|
||||
setMyLocation(request,"sysadmin?cmd=UM");
|
||||
return dlg;
|
||||
|
||||
@@ -339,7 +339,7 @@ public class SystemAdmin extends VeniceServlet
|
||||
{ // "G" - Edit Global Properties
|
||||
try
|
||||
{ // get the dialog box
|
||||
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog();
|
||||
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog(engine.getSecurityInfo());
|
||||
|
||||
if (dlg.isButtonClicked(request,"cancel"))
|
||||
throw new RedirectResult("sysadmin"); // we decided not to bother - go back
|
||||
|
||||
@@ -42,7 +42,7 @@ public class AdminModifyUserDialog extends ContentDialog
|
||||
addFormField(new CDPasswordFormField("pass2","Password","(retype)",false,32,128));
|
||||
addFormField(new CDTextFormField("remind","Password reminder phrase",null,false,32,255));
|
||||
addFormField(new CDRoleListFormField("base_lvl","Base security level",null,true,
|
||||
Role.getBaseLevelChoices()));
|
||||
Collections.EMPTY_LIST));
|
||||
addFormField(new CDCheckBoxFormField("verify_email","E-mail address verified",null,"Y"));
|
||||
addFormField(new CDCheckBoxFormField("lockout","Account locked out",null,"Y"));
|
||||
addFormField(new CDFormCategoryHeader("Name"));
|
||||
@@ -91,29 +91,23 @@ public class AdminModifyUserDialog extends ContentDialog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private void coreSetup(boolean is_global_admin, AdminUserContext admuser)
|
||||
private void coreSetup(AdminOperations ops, AdminUserContext admuser)
|
||||
{
|
||||
setSubtitle("User: " + admuser.getUserName());
|
||||
setHiddenField("uid",String.valueOf(admuser.getUID()));
|
||||
|
||||
CDPickListFormField level_field = (CDPickListFormField)modifyField("base_lvl");
|
||||
List role_list;
|
||||
if (is_global_admin)
|
||||
role_list = level_field.getChoicesList();
|
||||
else
|
||||
{ // not a global admin - deny user the right to select assistant admin choices
|
||||
role_list = Role.getBaseLevelChoices2();
|
||||
level_field.setChoicesList(role_list);
|
||||
|
||||
} // end else
|
||||
List role_list = ops.getAllowedRoleList();
|
||||
level_field.setChoicesList(role_list);
|
||||
|
||||
// See if this level was found on the list.
|
||||
Role my_role = admuser.getBaseRole();
|
||||
boolean found = false;
|
||||
Iterator it = role_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // seek each role in turn
|
||||
Role r = (Role)(it.next());
|
||||
if (r.getLevel()==admuser.getBaseLevel())
|
||||
if (r.equals(my_role))
|
||||
{ // found it!
|
||||
found = true;
|
||||
break;
|
||||
@@ -124,7 +118,7 @@ public class AdminModifyUserDialog extends ContentDialog
|
||||
|
||||
if (!found)
|
||||
{ // not in the list - set the defined "role list" to be a singleton of our current level
|
||||
role_list = Collections.singletonList(Role.getRoleForLevel(admuser.getBaseLevel()));
|
||||
role_list = Collections.singletonList(my_role);
|
||||
level_field.setChoicesList(role_list);
|
||||
|
||||
} // end if
|
||||
@@ -172,9 +166,9 @@ public class AdminModifyUserDialog extends ContentDialog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void setupDialog(boolean is_global_admin, AdminUserContext admuser) throws DataException
|
||||
public void setupDialog(AdminOperations ops, AdminUserContext admuser) throws DataException
|
||||
{
|
||||
coreSetup(is_global_admin,admuser);
|
||||
coreSetup(ops,admuser);
|
||||
|
||||
setFieldValue("base_lvl",String.valueOf(admuser.getBaseLevel()));
|
||||
if (admuser.isEmailVerified())
|
||||
@@ -281,9 +275,9 @@ public class AdminModifyUserDialog extends ContentDialog
|
||||
|
||||
} // end doDialog
|
||||
|
||||
public void resetOnError(boolean is_global_admin, AdminUserContext admuser, String message)
|
||||
public void resetOnError(AdminOperations ops, AdminUserContext admuser, String message)
|
||||
{
|
||||
coreSetup(is_global_admin,admuser);
|
||||
coreSetup(ops,admuser);
|
||||
setErrorMessage(message);
|
||||
setFieldValue("pass1",null);
|
||||
setFieldValue("pass2",null);
|
||||
|
||||
@@ -62,8 +62,9 @@ public class CommunityMembership implements JSPRender, SearchMode
|
||||
{
|
||||
this.engine = engine;
|
||||
this.comm = comm;
|
||||
this.role_choices = Role.getCommunityMemberLevelChoices();
|
||||
this.role_comm_host = Role.getCommunityHostRole();
|
||||
SecurityInfo sinf = comm.getSecurityInfo();
|
||||
this.role_choices = sinf.getRoleList("Community.UserLevels");
|
||||
this.role_comm_host = sinf.getRole("Community.Host");
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class EditCommunityProfileDialog extends ContentDialog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public EditCommunityProfileDialog()
|
||||
public EditCommunityProfileDialog(SecurityInfo sinf)
|
||||
{
|
||||
super("Edit Community Profile:",null,"commprofform","sigadmin");
|
||||
setHiddenField("cmd","P");
|
||||
@@ -145,15 +145,15 @@ public class EditCommunityProfileDialog extends ContentDialog
|
||||
null,YES));
|
||||
addFormField(new CDSimplePickListFormField("hidemode","Community visibility",null,true,vec_hidemode,'|'));
|
||||
addFormField(new CDRoleListFormField("read_lvl","Security level required to read contents",null,true,
|
||||
Role.getCommunityReadList()));
|
||||
sinf.getRoleList("Community.Read")));
|
||||
addFormField(new CDRoleListFormField("write_lvl","Security level required to update profile",null,true,
|
||||
Role.getCommunityWriteList()));
|
||||
sinf.getRoleList("Community.Write")));
|
||||
addFormField(new CDRoleListFormField("create_lvl","Security level required to create new subobjects",
|
||||
null,true,Role.getCommunityCreateList()));
|
||||
null,true,sinf.getRoleList("Community.Create")));
|
||||
addFormField(new CDRoleListFormField("delete_lvl","Security level required to delete community",null,true,
|
||||
Role.getCommunityDeleteList()));
|
||||
sinf.getRoleList("Community.Delete")));
|
||||
addFormField(new CDRoleListFormField("join_lvl","Security level required to join community",null,true,
|
||||
Role.getCommunityJoinList()));
|
||||
sinf.getRoleList("Community.Join")));
|
||||
|
||||
addFormField(new CDFormCategoryHeader("Conferencing Options"));
|
||||
addFormField(new CDCheckBoxFormField("pic_in_post","Display user pictures next to posts in conferences",
|
||||
|
||||
@@ -31,7 +31,7 @@ public class EditGlobalPropertiesDialog extends ContentDialog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public EditGlobalPropertiesDialog()
|
||||
public EditGlobalPropertiesDialog(SecurityInfo sinf)
|
||||
{
|
||||
super("Edit Global Properties",null,"globpropform","sysadmin");
|
||||
setHiddenField("cmd","G");
|
||||
@@ -44,7 +44,7 @@ public class EditGlobalPropertiesDialog extends ContentDialog
|
||||
addFormField(new CDIntegerFormField("audit_recs","Number of audit records to display per page",
|
||||
null,10,500));
|
||||
addFormField(new CDRoleListFormField("create_lvl","Security level required to create a new community",
|
||||
null,true,Role.getNewCommunityLevelChoices()));
|
||||
null,true,sinf.getRoleList("Global.CreateCommunity")));
|
||||
|
||||
addFormField(new CDFormCategoryHeader("Community Properties"));
|
||||
addFormField(new CDIntegerFormField("comm_mbrs","Number of community members to display per page",
|
||||
|
||||
Reference in New Issue
Block a user