ScrewTurn.Wiki.SessionFacade.GetCurrentUsername C# (CSharp) Method

GetCurrentUsername() public static method

Gets the current username for security checks purposes only.
public static GetCurrentUsername ( ) : string
return string
        public static string GetCurrentUsername()
        {
            string un = CurrentUsername;
            if(string.IsNullOrEmpty(un)) return AnonymousUsername;
            else return un;
        }

Usage Example

示例#1
0
        /// <summary>
        /// Returns a value indicating whether the current user can manage categories in the selected namespace.
        /// </summary>
        /// <returns><c>true</c> if the user can manage categories, <c>false</c> otherwise.</returns>
        private bool CanManageCategoriesInCurrentNamespace()
        {
            string        currentWiki         = DetectWiki();
            NamespaceInfo nspace              = Pages.FindNamespace(currentWiki, lstNamespace.SelectedValue);
            AuthChecker   authChecker         = new AuthChecker(Collectors.CollectorsBox.GetSettingsProvider(currentWiki));
            bool          canManageCategories = authChecker.CheckActionForNamespace(nspace, Actions.ForNamespaces.ManageCategories,
                                                                                    SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames(currentWiki));

            return(canManageCategories);
        }
All Usage Examples Of ScrewTurn.Wiki.SessionFacade::GetCurrentUsername