logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


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

Notification

Icon
Error

Options
Go to last post Go to first unread
RamKumar  
#1 Posted : Monday, June 4, 2018 5:07:01 AM(UTC)
RamKumar

Rank: Newbie

Groups: Registered
Joined: 5/31/2018(UTC)
Posts: 1
India
Location: Hyderabad

Is it possible to filter rows based on user login parameter when report's Security provider(authentication) is in "No Security" mode?
epf  
#2 Posted : Monday, June 4, 2018 6:02:00 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Normally, the user and password (coming from the login window) are saved in the WebUser object
Code:
                    WebUser.WebPrincipal = User; //Windows user IPrincipal
                    WebUser.WebUserName = user;
                    WebUser.WebPassword = password;


This is done when calling SWILogin.
You can always change the Security Provider Script.

Then a classic way to filter is to use this information in the additional WHERE clause of a table.

Code:
@using Seal.Model
@using Seal.Helpers
@{
    MetaTable table = Model;
    string restriction = Environment.UserName; //This gives the windows user of the process running the engine
    if (table.Source.Report != null && table.Source.Report.SecurityContext != null)
    {
        var securityContext = table.Source.Report.SecurityContext; //User is logged through a Web Report Servert and has a context
        restriction = securityContext.Name; //Name of the user set during the login
        restriction = securityContext.WebUserName; //Name got from the login window
        //securityContext.SecurityGroups; //List of security groups set for the user
        if (securityContext.BelongsToGroup("Default Group")) { //Test if the user belongs to a group
            //Special restriction here
        }
    }
    string result = string.Format("aColumnName={0}", Helper.QuoteSingle(restriction));
    }
@Raw(result)

Edited by user Monday, June 4, 2018 6:03:16 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (4)
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.