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

FM-2236 Add with_grant_option for user permissions #71

Merged
merged 2 commits into from Feb 27, 2015
Merged

FM-2236 Add with_grant_option for user permissions #71

merged 2 commits into from Feb 27, 2015

Conversation

cyberious
Copy link
Contributor

No description provided.

@Iristyle
Copy link
Contributor

FYI - minor typo in commit message.

Looks like there should be 2 commits here ... one for moving the file / directory structure around, and another for the actual work.

@Iristyle Iristyle changed the title FM-2236 Add with_grant_option for user permissiosn FM-2236 Add with_grant_option for user permissions Feb 24, 2015
USE [<%= @database %>];
<% if @with_grant_option == false %>
IF 'GRANT_WITH_GRANT_OPTION' = <%= scope.function_template(['sqlserver/snippets/user/permission/get_perm_state.sql.erb']) %>
REVOKE GRANT OPTION FOR <%= @_permission %> TO [<%= @user %>] CASCADE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a note about the use of CASCADE here?

Docs say

A cascaded revocation of a permission granted WITH GRANT OPTION will revoke both GRANT and DENY of that permission.

Is this our intended behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a user has been given GRANT OPTION they only way to remove that privilege is to CASCADE the changes.

REVOKE GRANT OPTION FOR SELECT FROM [user];
Msg 4611, Level 16, State 1, Line 9
To revoke or deny grantable privileges, specify the CASCADE option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you see a timing issue with this at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there the possibility of unset (undefined) from the perspective of bringing on existing permissions? That way if they haven't explicitly set true/false - then you don't manage the grant/revoke.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean? Do you mean have three possible states for grant_with_option? It is difficult to manage as it reports back a state_desc of GRANT or GRANT_WITH_GRANT_OPTION depending on which it is. So to say we accept GRANT or GRANT_WITH_GRANT_OPTION if 'unset'.

@cyberious
Copy link
Contributor Author

@Iristyle added comments to ticket FM-2236 in regards to the testing of the code

@cyberious
Copy link
Contributor Author

@Iristyle agreed it should have probably been in two commits, however it would be a messy untangle to remove them at this point, noted for future commits however.

@cyberious
Copy link
Contributor Author

Require #74 for shared function

SET @permission = '<%= permission %>'
<%= scope.function_template(['sqlserver/snippets/user/permission/exists.sql.erb']) %>
<% end %>
END
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is going to set all perms, then check each individually after and fail on the first one that doesn't exist?

I'd almost prefer for it to be atomic. Set one permission, check one permission, fail there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or one loop.

@cyberious
Copy link
Contributor Author

@ferventcoder updated to single loop

@@ -19,6 +19,9 @@
# [state]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permissions needs updated to show that it is an array.

@ferventcoder
Copy link
Contributor

The documentation needs updated to reflect permissions versus permission. This hasn't already shipped yet has it? If so this one will need a deprecation.

@ferventcoder
Copy link
Contributor

Other than the documentation change and the question, the rest LGTM

@cyberious
Copy link
Contributor Author

@ferventcoder Docs update for permissions instead of permission with accurate description.

@Iristyle
Copy link
Contributor

To answer #71 (comment) - the user manifest was not in the v1 release - see https://github.com/puppetlabs/puppetlabs-sqlserver/tree/1.0.0/manifests

Therefore, no deprecation notice required.

@Iristyle Iristyle merged commit 0a99b81 into puppetlabs:master Feb 27, 2015
@ferventcoder
Copy link
Contributor

👍

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.

None yet

3 participants