BlogEngine.Core.Security.DemandUserHasRight C# (CSharp) Method

DemandUserHasRight() public static method

If the current user does not have the requested rights, either redirects to the login page, or throws a SecurityException.
public static DemandUserHasRight ( AuthorizationCheck authCheck, bool redirectIfUnauthorized ) : void
authCheck AuthorizationCheck
redirectIfUnauthorized bool /// If true and user does not have rights, redirects to the login page or homepage. /// If false and user does not have rights, throws a security exception. ///
return void
        public static void DemandUserHasRight(AuthorizationCheck authCheck, bool redirectIfUnauthorized, params Rights[] rights)
        {
            if (!IsAuthorizedTo(authCheck, rights))
            {
                if (redirectIfUnauthorized)
                {
                    RedirectForUnauthorizedRequest();
                }
                else
                {
                    throw new SecurityException("User doesn't have the right to perform this");
                }
            }
        }

Same methods

Security::DemandUserHasRight ( Rights right, bool redirectToLoginPage ) : void