Rank: Newbie
Groups: Registered
Joined: 5/25/2016(UTC) Posts: 2 Location: Roma Thanks: 1 times
|
Hi everyone, I'm new with Seal Report.
Is possible to use the user (SecurityUser object defined in the authentication) as a restriction for a report (also via the Report Designer) ?
For example, I have a list of Site ID need to be passed as filter to the report, but the Site ID should be filtered by User Id.
Hope is clear.. and thank you for your help.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes, you can use the SecurityContext object, but only when connected with the Web Report Server as there is no security with the Report Designer. A classic approach is to define a dynamic "Additional Where Clause" in your table defined in your source. Then use Razor Script to do what you want, here is the template to filter on the logged user name: Code:@using Seal.Model
@using Seal.Helpers
@{
MetaTable table = Model;
string restriction = Environment.UserName;
if (table.Source.Report != null && table.Source.Report.SecurityContext != null)
{
restriction = table.Source.Report.SecurityContext.Name;
}
string result = string.Format("aColumnName={0}", Helper.QuoteSingle(restriction));
}
@Raw(result)
You can read also this post on security: https://sealreport.org/forum/default.aspx?g=posts&t=89#post171
|
1 user thanked epf for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.