12/08/2012

SharePoint 2010–Hiding "Sign in as Different User"

 

The "Sign in as Different User" is a bad idea for a lot of reasons, but the two biggest are:

  • Security on the computer where "User B" wants to access SharePoint. While at this computer they could perform any number of actions as "User A".
  • Mixed experiences when using software other than a browser. As an example, "User B" can "Sign in as Different User" on the "User A" computer. Everything done from the browser, such as adding list items, is logged as "User B", but many actions performed from Word, Outlook and other tools will be logged as "User A"

"Sign in as Different User" is available from the Welcome menu and from the Access Denied page:

           clip_image002[6]           clip_image002[8]

 

How a Site Owner can hide "Sign in as Different User"

You can hide the "Sign in as Different User" option by adding a small block of JavaScript code to your site's master page just before the </body> tag.

<script type="text/javascript"> 
var doc = document.getElementsByTagName('ie:menuitem');  
for (var i = 0; i < doc.length; i++)  
{
    itm = doc[i];
    if (itm.id.match('LoginAsDifferentUser') != null)
      { itm.hidden=true; }
 } 
</script> 

Note: You can still "Sign in as Different User" by navigating directly to the Access Denied page:
  http://yourserver/sites/yoursite/_layouts/AccessDenied.aspx

 

How a developer or server administrator can hide "Sign in as Different User"

As there are two ways a user can get to the "Sign in as Different User" option you will need to make two different changes, one to the Welcome menu and one to the Access Denied page.

Warning:

  • Changes to ControlTemplates and Layouts folder impact all users on all sites in the farm!
  • Changes to the pages in the ControlTemplates and Layouts folder need to be documented as farm rebuilds or service pack updates could overwrite your changes.
  • You should make a backup copy of any files you edit.
  • All changes must be made identically on all web front end servers.
Updating the Welcome menu

The Welcome menu is implemented as an ASPX user control (.ascx) and is stored in the …\14\TEMPLATE\CONTROLTEMPLATES folder. Editing this file impact all users on all sites in the farm. You may want to use the "Site Owner" solution listed earlier in this article. Another option is to create a copy of the Welcome.ascx file and modify selected master pages to point to the custom version of the file.

  1. Open the Welcome.ascx file (or your custom copy) using Notepad or Visual Studio from
        …\14\TEMPLATE\CONTROLTEMPLATES 
  2. Find the MenuItemTemplate with the ID of ID_LoginAsDifferentUser
  3. Then do one of the following
    • Delete the MenuItemTemplate control
    • Add these two options to the MenuItemTemplate control to limit the display of the menu item to only Site Owners
         PermissionsString="ManageWeb"
         PermissionMode="Any"
Updating the Access Denied page (AccessDenied.aspx)
  1. Open the AccessDenied.aspx page using Notepad or Visual Studio:
       …\14\TEMPLATE\AccessDenied.aspx
  2. Find the following code:
      <asp:HyperLink id="HLinkLoginAsAnother"
      Text="<%  $SPHtmlEncodedResources:wss,accessDenied_logInAsAnotherOne%>"
      CssClass="ms-descriptiontext" runat="server"/>
  3. Then do one of the following:
    • Delete the code
    • Wrap the code in a comment block
    • Wrap the code in a SPSecurityTrimmedControl with a permission level such as ManageWeb (see this article) so Site Owner can still see the option.

<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageWeb">

  <asp:HyperLink id="HLinkLoginAsAnother"
  Text="<%$SPHtmlEncodedResources:wss,accessDenied_logInAsAnotherOne%>"
  CssClass="ms-descriptiontext" runat="server"/>
</SharePoint:SPSecurityTrimmedControl>

 

.

12/05/2012

Cincinnati SharePoint User Group

 

The December meeting has been canceled!

http://www.CincinnatiSPUG.org

January 2013 Meeting - SharePoint and SQL Server

Lisa Gardner will present on SharePoint and SQL Server

Lisa Gardner
Microsoft Premier Field Engineer
SQL Server
US PFE - Central Region

SharePoint is a rapidly growing application that relies heavily on SQL Server. In this session, we will discuss what a DBA needs to know to successfully manage instances hosting SharePoint databases. What configuration options are best for a SharePoint workload? What kind of maintenance should be performed? How should databases be provisioned? What the heck are all these databases for anyway? We will also discuss some nomenclature and key components of SharePoint to help DBAs better communicate with SharePoint application teams.

This presentation is aimed at DBAs who have to manage SharePoint databases, but it definitely pertains to SharePoint administrators as well.

  • Outline:
    • SharePoint Overview
    • SharePoint Databases – what they are, best practices, sizing guidance
    • SQL Server Configuration, Setup, and Maintenance for hosting SharePoint
    • What to look out for – common

 

 

See you in January!

http://www.CincinnatiSPUG.org

12/04/2012

SharePoint 2007 PowerShell cmdlets

 

This article includes the 2007 functions to emulate the SharePoint 2010 cmdlets used in my series of articles in SharePoint Pro Magazine. The first article, Exploring and Inventorying SharePoint Using PowerShell, is here: http://www.sharepointpromag.com/article/sharepoint-server-2010/exploring-inventorying-sharepoint-using-powershell-144834 . Part 2 is here: http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts with part 3 to follow.

Check back over the next week or two as I expand this content and add links to download the PowerShell module…

While this little project will in no way include all of the 500 SharePoint 2010 cmdlets, it will provide a core set of cmdlets needed to run my auditing and inventorying SharePoint 2010 PowerShell scripts. These cmdlets are implemented as PowerShell functions so you can study them and enhance them or even use them as models to create additional cmdlets. There will also be links to a download you can simply load them as a PowerShell module.

 

As a teaser… here's a starter set…   (check back in a few days for the full article)

Save the following as SP2007cmdlets.psm1:

#Notes:
# The scripts below are from http://TechTrainingNotes.blogspot.com 
# These scripts may be used in your projects but may not be republised in any form
# Formatting data found in SP2007cmdlets.format.ps1xml  (optional)

function Get-SP2007help
{
"Currently implemented cmdlets:"
"  Get-SPFarm"
"  Get-SPWebApplication"
"  Get-SPSite"
"  Get-SPWeb"
"  Get-SP"
}

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")


function Get-SPFarm()
{
  [Microsoft.SharePoint.Administration.SPFarm]::Local
}


function Get-SPWebApplication ($url)
{
  begin
  {  $foundit=$false
     if ($url -ne $null) { 
       $foundit=$true; 
       [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("$url") }
  }
  process
  {
  }
  end
  {
    if ($foundit -eq $false)
    {
       [Microsoft.SharePoint.Administration.SPWebService]::ContentService.WebApplications
    }
  }
}



function Get-SPSite ([string]$Identity, [string]$ContentDatabase)
{
<#
.SYNOPSIS
 Returns all site collections that match the given criteria.
.PARAMETER computername
  The computer name to query. Just one.
.DESCRIPTION
 The Get-SPSite cmdlet returns either a single site that matches the Identity parameter, or all the sites that match the Filter parameter for the specified scope. The scopes are the WebApplication, ContentDatabase , and SiteSubscription parameters. If none of these scopes is provided, the scope is the farm. If the scope is specified with parameter, all sites in that scope are returned.
.PARAMETER Identity 
 Specifies the URL or GUID of the site collection to get. The type must be a valid URL, in the form http://server_name or http://server_name/sites/sitename, or a valid GUID (for example, 12345678-90ab-cdef-1234-567890bcdefgh).
.PARAMETER ContentDatabase
Specifies the GUID of the content database from which to list site collections.

The type must be a valid database name, in the form  SPContentDB01, or a valid GUID (for example, 12345678-90ab-cdef-1234-567890bcdefgh).
#>

  begin
  {  $foundit=$false
     if ($Identity -ne "" -or $ContentDatabase -ne "") { 
       $foundit=$true;
       if ($ContentDatabase -ne "")
       {
         if(Test-TTNIsGuid($ContentDatabase))
         {
          Get-SPWebApplication | select -ExpandProperty ContentDatabases | where { $_.id -eq "$ContentDatabase"} | get-spsite
         }
         else 
         { 
          Get-SPWebApplication | select -ExpandProperty ContentDatabases | where { $_.name -eq "$ContentDatabase"} | get-spsite
         }
       }
       else
       {
         if ($Identity.toLower().StartsWith("http"))
           { New-Object Microsoft.SharePoint.SPSite("$Identity") }
         else 
           { New-Object Microsoft.SharePoint.SPSite([guid]"$Identity") }
       }
     }
  }
  process
  {
    if ($_ -ne $null)
    {
      $foundit=$true;  $_.Sites
    }
  }
  end
  {
    if ($foundit -eq $false)
    {
       Get-SPWebApplication | Get-SPSite
    }
  }
}


function Get-SPWeb ($url)
{
  begin
  {
     if ($url -ne $null) { (New-Object Microsoft.SharePoint.SPSite("$url")).OpenWeb() }
  }
  process
  {
     $_.AllWebs
  }
}


function Test-TTNIsGuid ($guid)
{
  # TechTrainingNotes helper function
  ($guid -match "^[A-Fa-f0-9]{32}$|({|\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\))?$|^({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})$")
}

Save the following as SP2007cmdlets.format.ps1xml: 
( file to be posted with the complete article )
 
. 

11/27/2012

SharePoint 2013 First Looks for ITPros and Developers

 

I will be presenting two FREE First Look clinics this Friday at MAX Technical Training. You can attend these sessions in person at MAX's Mason, Ohio training center or remotely using your PC.

Just for fun, when registering… add a note that "Mike sent me!"  (Or maybe… "Attending in spite of Mike")

 

MS-40027 First Look: What's New for Developers in Microsoft SharePoint 2013

More info here: http://www.maxtrain.com/Classes/ClassInfo.aspx?Id=43826

This 1/2 day instructor-led developer first-look course provides an overview of the new features, functional areas, product enhancements, and application models in SharePoint 13.

At Course Completion

  • Provide an overview of the new features, functional areas, and product enhancements in SharePoint 2013.
  • Summarize the key features of the SharePoint 2013 application development platform and describe the key features of Marketplaces.
  • Explain what a SharePoint-Hosted app is, and describe how to build a SharePoint-Hosted app.
  • Explain what a Cloud-Hosted app is, and describe how to build a Cloud-Hosted app.
  • Describe how developers extend Office Application user interfaces by creating Apps for Office and publishing them in different catalogs.
  • Describe how to create and code a simple App for Office that interacts with document content.
  • Describe improvements in Manage Metadata Services, Enterprise Content Management and Web Content Management in SharePoint 2013.
  • Describe the new social networking functionality available to SharePoint 2013 App developers.
  • Describe how the new capabilities of the SharePoint Search engine can be used in SharePoint Apps.
  • Describe how to query the index from a SharePoint-Hosted app using CSOM.

 

MS-40028 First Look Clinic: What’s New for IT Professionals in Microsoft SharePoint Server 2013

More info here: http://www.maxtrain.com/Classes/ClassInfo.aspx?Id=44107

This 1/2 day instructor-led first-look clinic explains the new and improved product features as applicable to IT Professionals and how to install, deploy, manage, and administer SharePoint Server 2013. It also provides information on how to integrate SharePoint Server 2013 with key applications and how to maintain and troubleshoot SharePoint Server 2013.

At course completion:

  • Identify the major new features in SharePoint 2013 for IT Pros
  • Discuss the major architectural changes in SharePoint 2013
  • Describe the major changes to the BCS and the search service
  • Describe the new BI and composites features in SharePoint 2013
  • Describe the new content management and compliance features
  • Identify the new features for social computing and mobile users

 

See ya Friday!

 

.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.