apiVersion: v1alpha1
kind: "Role"
metadata:
  name: role-template-manage-plugins
  labels:
    halo.run/role-template: "true"
  annotations:
    rbac.authorization.halo.run/dependencies: |
      [ "role-template-view-plugins" ]
    rbac.authorization.halo.run/module: "Plugins Management"
    rbac.authorization.halo.run/display-name: "Plugin Manage"
    rbac.authorization.halo.run/ui-permissions: |
      ["system:plugins:manage"]
rules:
  - apiGroups: [ "plugin.halo.run" ]
    resources: [ "plugins" ]
    verbs: [ "create", "patch", "update", "delete", "deletecollection" ]
  - apiGroups: [ "api.console.halo.run" ]
    resources: [ "plugins/upgrade", "plugins/resetconfig", "plugins/config", "plugins/reload",
                 "plugins/install-from-uri", "plugins/upgrade-from-uri", "plugins/plugin-state" ]
    verbs: [ "*" ]
  - apiGroups: [ "api.console.halo.run" ]
    resources: [ "plugin-presets" ]
    verbs: [ "list" ]
  - nonResourceURLs: [ "/apis/api.console.halo.run/v1alpha1/plugins/*" ]
    verbs: [ "create" ]
---
apiVersion: v1alpha1
kind: "Role"
metadata:
  name: role-template-view-plugins
  labels:
    halo.run/role-template: "true"
  annotations:
    rbac.authorization.halo.run/module: "Plugins Management"
    rbac.authorization.halo.run/display-name: "Plugin View"
    rbac.authorization.halo.run/ui-permissions: |
      ["system:plugins:view"]
rules:
  - apiGroups: [ "plugin.halo.run" ]
    resources: [ "plugins" ]
    verbs: [ "get", "list" ]
  - apiGroups: [ "api.console.halo.run" ]
    resources: [ "plugins", "plugins/setting", "plugins/config" ]
    verbs: [ "get", "list" ]
