Skip to content

mysql_user, mysql_role: add option to revoke privileges explicitly #331

@betanummeric

Description

@betanummeric

SUMMARY

When updating a role, its privileges are either added or replaced, depending on the append_privs argument. I would like to add an argument to revoke privileges explicitly.

USECASE

I read the desired privileges from a dynamic source. To ensure no privileges are revoked in case the dynamic source accidentally returns incomplete information, I need to revoke privileges explicitly.

ISSUE TYPE

  • Feature Idea

COMPONENT NAME

modules mysql_role, mysql_user

IMPLEMENTATION IDEAS

I propose 3 alternative ways to implement that:

1) add argument subtract_privs

Add a new boolean argument subtract_privs (default no, mutual conflict with append_privs). If enabled, the module would revoke the privileges specified by priv (without granting any privileges).

2) add argument revoke_privs

Add a new argument revoke_privs which takes the same format as privs. If set, all privileges in revoke_privs that are not in privs will be revoked.
privs and append_privs continue to work as before.

3) add argument privilege_state, deprecate option append_privs

Add a new argument privilege_state with three possible values:

  • exact (default, like previous behavior with append_privs: no)
  • granted (like previous behaviour with append_privs: yes)
  • revoked (revoke all privileges specified by priv)

This options should mutually conflict with append_privs. privilege_state: granted should be used instead of append_privs: yes.

What implementation idea would you prefer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions