6

In the past (2013 SP1), adding a user that was an admin via core service, I could do something like this:

$user.Privileges = 1

but now, with SDL Web 8.5, UserData.Privileges is "obsolete" and doesn't work (shame on SDL for not deprecating it and giving us time to migrate to new API, but I digress). So, using that fails. What's the new approach for marking a user as system administrator? Do I have to explicitly add the new "System Administrator" group to the user?

7

Well... I think that I have a solution (I realize it has some helper function calls) but this appears to work. Unless someone has a better way of doing this.

     if (((Get-TridionCoreServiceSettings).Version).toLower().startsWith("sdlweb"))
        {
            #it's a whole new way...
            if ($IsAdmin)
            {
                #add "System Administrator" to existing group assignments
                $GroupAssignments = Set-TridionUserGroups -GroupList "System Administrator" -AllGroups (Get-TridionGroups) -ExistingGroupAssignments $GroupAssignments
            }
        }
        else
        {
            if ($IsAdmin)
            {
                $user.Privileges = 1
            }
            else
            {
                $user.Privileges = 0
            }
        }
  • 2
    I just wanted to say that you are on the right track here. The new way to make someone a System Administrator is indeed to add them to a group that has the System Administration privilege. As you can probably imagine, that change is pretty hard to make completely backwards compatible. I think everybody involved wishes we could have, but it simply wasn't feasible. Functionally, the new way offers much more control so we're all better off now. But I do indeed need to find a good way to solve that in the PowerShell modules :) – Peter Kjaer Feb 23 '17 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.