Ok, i will try to explain in more detail - with more info about what i did and what the result was
first i added this to section.cs
public virtual bool AnonymousSearchAllowed
{
get
{
foreach (Permission p in this._sectionPermissions)
{
if (p.SearchAllowed && Array.IndexOf(p.Role.Permissions, AccessLevel.Anonymous) > -1)
{
return true;
}
}
return false;
}
}
public virtual bool SearchAllowed(IIdentity user)
{
User cuyahogaUser = user as User;
if (this.AnonymousSearchAllowed)
{
return true;
}
else if (cuyahogaUser != null)
{
return cuyahogaUser.CanSearch(this);
}
else
{
return false;
}
}
public virtual bool SearchAllowed(Role role)
{
foreach (SectionPermission sp in this.SectionPermissions)
{
if (sp.Role == role && sp.SearchAllowed)
{
return true;
}
}
return false;
}
add this to the section.hbm.xml, for nhibernate (also added a column in the db, section_noderole i believe it was, next to viewallowed,editallowed)
property searchallowed for nhibernate > see pastebin, forum software says its potentially dangerous code im pasting here
in the permissions class, i added
private bool _searchAllowed;
public bool SearchAllowed
{
get { return this._searchAllowed; }
set { this._searchAllowed = value; }
}
protected Permission()
{
this._searchAllowed = false;
}
to the admin sectionedit.aspx i added the extra column (below .. chkEditAllowed )
i cannot paste that TD line here, as the forum software thinks its potentially dangerous code see pastebin
in the codebehind .cs i added
CheckBox chkSearch = (CheckBox)ri.FindControl("chkSearchAllowed");
//UNDER SetRoles()
if (chkView.Checked || chkEdit.Checked || chkSearch.Checked)
{
sp.SearchAllowed = chkSearch.Checked;
}
in the same file, (sectionedit.aspx.cs), i placed the following under the if (role!=null) { }
CheckBox chkSearch = (CheckBox)e.Item.FindControl("chkSearchAllowed");
chkSearch.Checked = this._activeSection.SearchAllowed(role);
OR >> ? ??
CheckBox chkSearch = (CheckBox)e.Item.FindControl("chkSearchAllowed");
chkSearch.Checked = this._activeSection.SearchAllowed(HttpContext.Current.User.Identity);
I'm not sure about what should be used of the above two, i dont have indepth knowledge about user authorization in ASP
When i viewed section properties, they were all unselected (while i did put them all on true/1 in the db). Look(ed)(s) like a nhibernate problem? > not sure
The result was that if i selected all items, and clicked on 'save' .. the settings were saved, if i unchecked just one item and clicked 'save' nothing was saved
well, i do think it was saved to the database, because the settings did have good effect, for as far as i could see
In an attempt to try and fix it i also placed code in the Node.cs / NodeEdit.cs / Nodepermissions, so you can specify per node if it can be searched trough..
but that worked about as bad as the extra section property.... > no asp errors in debug mode tough, been stepping trough a lot as well..
i think it goes wrong somewhere with the SearchAllowed calls.
I really hope that this feature.. when it works... could be added to Cuyahoga to extend the search options with.