Skip to content

Plugin permissions#239

Open
Maks-s wants to merge 7 commits into
JsSucks:masterfrom
Maks-s:plugin-permissions
Open

Plugin permissions#239
Maks-s wants to merge 7 commits into
JsSucks:masterfrom
Maks-s:plugin-permissions

Conversation

@Maks-s
Copy link
Copy Markdown

@Maks-s Maks-s commented Aug 22, 2018

Plugin permissions system

Add the following functions to Permissions Manager :

  • addPluginPermission(id, permission)
  • addPluginPermissions(id, permissions)
  • removePluginPermission(id, permission)
  • removePluginPermissions(id)
  • hasPermission(id, permission)
  • getPermissions(id)

+ add permission check for getPlugin / getTheme / getModule with GET_INSTALLED_COMPONENT

@zerebos
Copy link
Copy Markdown
Member

zerebos commented Aug 22, 2018

oh not nearly as thorough as I thought it would be, also having Plugin in addPluginPermission seems kinda redundant because the permissions manager is specifically for plugins

@Maks-s
Copy link
Copy Markdown
Author

Maks-s commented Aug 22, 2018

What should be added for it to be thorough ?

@zerebos
Copy link
Copy Markdown
Member

zerebos commented Aug 22, 2018

Lots of additional permissions for plugins access to things like parts of DiscordApi.

@Maks-s
Copy link
Copy Markdown
Author

Maks-s commented Aug 23, 2018

Hmm, this PR is meant to only add a system for permissions, not actually add the permissions. getPlugin / getTheme / getModule are more of a PoC

EDIT: Also changed functions name to

  • add(id, permission)
  • addMultiple(id, permissions)
  • remove(id, permission)
  • removeAll(id)
  • get(id, permission)
  • getAll(id)

Comment thread client/src/modules/contentmanager.js Outdated
Logger.warn(this.moduleName, [`Failed reading config for ${this.contentType} ${readConfig.info.name} in ${dirName}`, err]);
}

if (this.contentType === 'plugin') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Everything here should be in the plugin manager.

Comment thread client/src/modules/permissionmanager.js Outdated
},
GET_INSTALLED_COMPONENT: {
HEADER: 'Use installed components',
BODY: 'Allows :NAME: to interact with other plugins / themes / modules'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Plugins can already interact with other plugins, so maybe control instead of interact with?

Comment thread client/src/modules/permissionmanager.js Outdated
* @param {String} permission Permission to add
* @return {Promise}
*/
static async add(id, permission) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why are these asynchronous?

@zerebos zerebos requested a review from Jiiks March 27, 2019 15:46
Maks-s added a commit to Maks-s/BetterDiscordApp that referenced this pull request Jul 17, 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.

3 participants