/** * The displayed color of this member in hexadecimal * @type {string} * @readonly */ get displayHexColor() { const role = this.roles.color; return (role && role.hexColor) || '#000000'; }
message.guild .roles .create() .then(role => { message.channel.send(`Made role ${role.name}`); }) .catch(console.error);
const ProtectedListPage = () => ( <CheckPagePermissions permissions={adminPermissions.settings.roles.main}> <ListPage /> </CheckPagePermissions> )
// Delete crate export async function remove(parentValue, { id }, { auth }) { if(auth.user && auth.user.role === params.user.roles.admin) { return await models.Crate.destroy({where: {id}}) } else { throw new Error('Operation denied.') } }
/** * The overall set of permissions for this member, taking only roles into account * @type {Readonly<Permissions>} * @readonly */ get permissions() { if (this.user.id === this.guild.ownerID) return new Permissions(Permissions.ALL).freeze(); return new Permissions(this.roles.cache.map(role => role.permissions)).freeze(); }
["prebuiltEntities", "patternAnyEntities", "regex_entities", "closedLists", "composites", "entities"].forEach(scope => { luisJSON[scope].forEach(item => { if (item.roles.length > retCode.boundaryLimits.MAX_ROLES_PER_ENTITY) { validationError(retCode.errorCode.BOUNDARY_ROLES_PER_ENTITY, `${scope.substring(0, scope.length - 1)} ${item.name} has ${item.roles.length} roles. At most ${retCode.boundaryLimits.MAX_ROLES_PER_ENTITY} is allowed.`) } totalRoles += item.roles.length; }) })
/** * Whether the role is editable by the client user * @type {boolean} * @readonly */ get editable() { if (this.managed) return false; const clientMember = this.guild.member(this.client.user); if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return false; return clientMember.roles.highest.comparePositionTo(this) > 0; }
it ('roles can have spaces in them', function(done) { let lufile = ` @ ml "entity 1" hasRoles "role 1", "role 2" ` parseFile.parseFile(lufile) .then(res => { assert.deepEqual(res.LUISJsonStructure.entities[0].roles, ["role 1", "role 2"]); done() }) .catch(err => done(err)) })
_this.requiresLogin(req, res, function() { if (_.intersection(req.user.roles, roles).length) { return next(); } else { return res.status(403).send({ message: 'User is not authorized' }); } });
const addPatternAnyEntities = function(luisJSON, entitiesList, entityFound){ luisJSON.patternAnyEntities.forEach(function (entity) { entityFound = helpers.filterMatch(entitiesList, 'name', entity.name); if (entityFound.length === 0) { entitiesList.push(new validateLUISBlobEntity(entity.name, ['patternAny'], entity.roles)); } else { entityFound[0].type.push('patternAny'); } }); }
/** * Creates a collection of this guild's roles, sorted by their position and IDs. * @returns {Collection<Role>} * @private */ _sortedRoles() { return Util.discordSort(this.roles.cache); }
value.roles.forEach(rule => { parseACL[`role:${rule.roleName}`] = { read: rule.read, write: rule.write }; });
const ProtectedListPage = () => ( <CheckPagePermissions permissions={adminPermissions.settings.roles.main}> <ListPage /> </CheckPagePermissions> )