Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security related commands #144

Merged
merged 34 commits into from
Apr 19, 2019
Merged

Add security related commands #144

merged 34 commits into from
Apr 19, 2019

Conversation

MichelZ
Copy link
Contributor

@MichelZ MichelZ commented Feb 18, 2019

PR Summary

Adding Security related functions

PR Checklist

@MichelZ
Copy link
Contributor Author

MichelZ commented Feb 18, 2019

@DarqueWarrior Work in Progress, but I thought I'd share this already so you can give initial feedback. Thanks!

@MichelZ MichelZ mentioned this pull request Feb 18, 2019
@DarqueWarrior
Copy link
Collaborator

DarqueWarrior commented Feb 18, 2019

I put in a check that validates the help files are created with a title that matches the filename. This is to catch copy and paste errors. But it also catches empty files. So if you want the build to succeed you are going to have to fill in the help files.

What is up with Get-VSTeamUser2? Not sure why you are not just changing the current function. Get-VSTeamUser might just need two Parameter sets. One that matches the existing params and one for your current 2 version.

@MichelZ
Copy link
Contributor Author

MichelZ commented Feb 18, 2019

Yes, I will fill them ASAP.

I wasn't sure about changing Get-VSTeamUser, because it does things a little different than Get-VSTeamUser2.
How are your feelings about breaking changes? e.g. rename Get-VSTeamUser to Get-VSTeamUserEntitlement, or Get-VSTeamUserLicense or something like this? That seems to resemble more what the function currently does, and then rename Get-VSTeamUser2 to Get-VSTeamUser ?

@DarqueWarrior
Copy link
Collaborator

Breaking changes are ok as long as the version number reflects it and it is clearly described in change log.

@DarqueWarrior
Copy link
Collaborator

We also need to be very clear in the docs the difference between what is being returned from each function. On the surface the results look very similar.

@DarqueWarrior
Copy link
Collaborator

How is this work coming? Seems like a huge change.

@MichelZ
Copy link
Contributor Author

MichelZ commented Feb 25, 2019

Still working on it. Got a couple more things that I'd like to add.
If you think it's too large, let me know and we can try splitting it up a bit

@MichelZ MichelZ marked this pull request as ready for review February 28, 2019 14:40
@MichelZ MichelZ changed the title [WIP] Add security related commands Add security related commands Feb 28, 2019
@MichelZ
Copy link
Contributor Author

MichelZ commented Feb 28, 2019

@DarqueWarrior I think this one is ready for a deeper review now

@DarqueWarrior
Copy link
Collaborator

Sorry for delay I hope to have time this weekend.

@DarqueWarrior
Copy link
Collaborator

I will test again. I can give you access to my TFS 2017 and 2018 instances so you can test as well.

@MichelZ
Copy link
Contributor Author

MichelZ commented Mar 20, 2019

That would be very nice of you and extremely helpful

@MichelZ
Copy link
Contributor Author

MichelZ commented Mar 25, 2019

@DarqueWarrior Can you get me these login credentials? Thx!

@MichelZ
Copy link
Contributor Author

MichelZ commented Apr 7, 2019

@DarqueWarrior OK, the issue is that TFS can only query security namespaces by ID, whereas AzD can actually them. I think querying them by ID has not much value, so I made that whole command "AzD-only".
Also tested the commands with TFS and fixed a bug encountered while using TFS.

@DarqueWarrior
Copy link
Collaborator

I see there is a warnning. Source\Public\Remove-VSTeamAccessControlList.ps1(1,10): Warning : Function 'Remove-VSTeamAccessControlList' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.

@MichelZ
Copy link
Contributor Author

MichelZ commented Apr 11, 2019

Fixed. I'm not sure why it throws there now though...


` Context _handleException
      [-] Should Write two warnings 11ms
        NullReferenceException: Object reference not set to an instance of an object.
        MethodInvocationException: Exception calling "GetParamBlock" with "1" argument(s): "Object reference not set to an instance of an object."
        at Mock, /home/vsts/.local/share/powershell/Modules/Pester/4.7.3/Functions/Mock.ps1: line 237
        at <ScriptBlock>, /home/vsts/work/1/s/unit/test/common.Tests.ps1: line 89
Context _handleException message only
  [-] Should Write one warnings 10ms
    NullReferenceException: Object reference not set to an instance of an object.
    MethodInvocationException: Exception calling "GetParamBlock" with "1" argument(s): "Object reference not set to an instance of an object."
    at Mock, /home/vsts/.local/share/powershell/Modules/Pester/4.7.3/Functions/Mock.ps1: line 237
    at <ScriptBlock>, /home/vsts/work/1/s/unit/test/common.Tests.ps1: line 104`

@DarqueWarrior
Copy link
Collaborator

I will look into it.

@DarqueWarrior
Copy link
Collaborator

When unit tests only fail on Mac or Linux it can sometimes be a casing issue.

@DarqueWarrior
Copy link
Collaborator

Strange I just ran on my local Mac and Ubuntu machines and they all pass.

@DarqueWarrior
Copy link
Collaborator

There is something going on with the latest version of PowerShell core. If you install 6.2.0 you will get the same errors. Not sure why this is broken. Maybe @SteveL-MSFT knows if something changed in 6.2.0 that could cause this error.

@DarqueWarrior
Copy link
Collaborator

I think I have a way to test the code without mocking ConvertFrom-JSON which is causing the Null reference exception. Something still seems to be off or different in version 6.2.0 of PowerShell core but I don't want to hold this PR until that is investigated. I will work on new tests this weekend.

@SteveL-MSFT
Copy link

@DarqueWarrior can you summarize the issue you're seeing with PSCore6.2?

@DarqueWarrior DarqueWarrior merged commit af9c7fa into MethodsAndPractices:master Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants