Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Wednesday, May 25, 2016 10:31:10 AM(UTC)

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.

#2 Posted : Wednesday, May 25, 2016 3:21:48 PM(UTC)

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 653

Thanks: 9 times
Was thanked: 111 time(s) in 108 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:

@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));

You can read also this post on security:
thanks 1 user thanked epf for this useful post.
vins on 5/25/2016(UTC)
Users browsing this topic
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.