This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function c(name) { | |
| return $x(`//div[@role="listitem" and @jscontroller and .//*[@role="heading" and text()[contains(., "${name}")]]]`)[0]; | |
| } | |
| function report(attrs) { | |
| const name = c('Name'); | |
| name.click(); | |
| setTimeout(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Just add this script as `after_build` and `after_prepare` hook in config.xml for ios platform. | |
| */ | |
| const { join } = require('path') | |
| const fs = require('fs') | |
| // TODO: Remove this after https://issues.apache.org/jira/browse/CB-11311 is fixed | |
| module.exports = function(ctx) { | |
| if (!ctx.opts.browserify) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Ability, AbilityBuilder, toMongoQuery } = require('casl') | |
| const { Forbidden } = require('feathers-errors') | |
| const TYPE_KEY = Symbol.for('type') // <--- added | |
| // the rest of the logic | |
| function subjectName(subject) { // <--- added | |
| if (!subject || typeof subject === 'string') { | |
| return subject | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { authenticate } = require('feathers-authentication').hooks | |
| const { NotAuthenticated } = require('feathers-errors') | |
| const verifyIdentity = authenticate('jwt') | |
| function hasToken(hook) { | |
| return hook.params.headers.authorization || hook.data.accessToken | |
| } | |
| module.exports = async function authenticate(hook) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { when } = require('feathers-hooks-common') | |
| const authorize = require('./hooks/abilities') | |
| const authenticate = require('./hooks/authenticate') | |
| module.exports = { | |
| before: { | |
| all: [ | |
| when( | |
| hook => hook.params.provider && `/${hook.path}` !== hook.app.get('authentication').path, | |
| authenticate, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Ability, AbilityBuilder, toMongoQuery } = require('casl') | |
| const { Forbidden } = require('feathers-errors') | |
| // the rest of the logic | |
| module.exports = function authorize(name = null) { | |
| return async function(hook) { | |
| const action = hook.method | |
| const service = name ? hook.app.service(name) : hook.service | |
| const serviceName = name || hook.path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Ability, AbilityBuilder } = require('casl') | |
| Ability.addAlias('update', 'patch') | |
| Ability.addAlias('read', ['get', 'find']) | |
| Ability.addAlias('remove', 'delete') | |
| // the rest of the logic | |
| module.exports = function authorize(serviceName) { | |
| return async (hook) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { AbilityBuilder, Ability } = require('casl') | |
| function defineAbilitiesFor(user) { | |
| const { rules, can } = AbilityBuilder.extract() | |
| can('read', ['posts', 'comments']) | |
| if (user) { | |
| can('manage', ['posts', 'comments'], { author: user._id }) | |
| can(['read', 'update'], 'users', { _id: user._id }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <nav class="menu"> | |
| <h3>Menu</h3> | |
| <ul> | |
| <li if.bind="'Post' & can: 'create'"> | |
| <a route-href="route: newPost">Add Post</a> | |
| </li> | |
| </ul> | |
| </nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SignalBindingBehavior } from 'aurelia-templating-resources' | |
| import { ValueConverter } from 'aurelia-binding' | |
| export class CanBindingBehavior { | |
| static inject = [SignalBindingBehavior] | |
| constructor(signalBindingBehavior) { | |
| this.signalBindingBehavior = signalBindingBehavior | |
| } |