Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-arcgis-portal-services

Package Overview
Dependencies
Maintainers
5
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-arcgis-portal-services

A set of promise-based Ember Services for working with the ArcGIS Portal API.

  • 0.28.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
129
increased by616.67%
Maintainers
5
Weekly downloads
 
Created
Source

ember-arcgis-portal-services

Ember Services for working with ArcGIS Portal/Online

Note This is still a very nascent project, and things will change.

Be sure to lock to a specific version in your own package.json. We expect many breaking changes before a stable v1.0.0 public API is released.

ArcGIS Portal Services

After adding this to your project, you will have a number of services available for injection into your routes/controllers/services.

Dependencies

This project is now using ember-network/fetch, which is included in dependencies, to enable fastboot compatibility. If you're using torii for oauth management, please also npm install torii-provider-arcgis. More information here. Otherwise, you can use the portalOpts parameter described below, but you need a service named session in your app or addon. You can generate a dummy service using ember generate service session. TODO: there's probably a better way to do this...

Installation

To consume this library in any ember application:

  • ember install ember-arcgis-portal-services

Shared Methods

All the services expose a set of shared helper properties and methods:

PropertyReturnsDescription
portalRestUrl (deprecated)stringReturn the ArcGIS Portal Rest base url
portalUrl (deprecated)stringReturn the ArcGIS Portal base url (for visiting pages etc)
geocodeUrlstringReturn the geocode base url

NOTE: Most public methods take an optional portalOpts parameter. This takes the form:

{
  portalHostname
  token
}
MethodReturnsDescription
encodeFormstringThis is used internally. Formats an object into a html form. In most cases, not necessary to call this.
request (url, options, portalOpts)promiseThis is used internally. Promisified xhr that does basic handling of Portal's 400-in-a-200 errors

Items Service

MethodReturnsDescription
search(form)promiseExecutes via /sharing/rest/search. The form is an object properties matching the search params
getById(id, portalOpts)promiseReturns the Item.
getDataById(id, portalOpts)promiseReturns the Item-Data (/data).
update(item, portalOpts)promiseUpdates an existing item. The .owner property must be set.
create(item, portalOpts)promiseCreates an item. The .owner property must be set.
remove(itemId, owner, portalOpts)promiseDelete the item.
protect(itemId, owner, portalOpts)promiseProtect the item (to avoid accidental deletion).
unprotect(itemId, owner, portalOpts)promiseUnprotect the item.
getRelatedItems(itemId, relationshipType, direction, portalOpts)promiseRelated Items
addRelationship (username, itemId, destItemId, relType, portalOpts)promiseAdd a relationship between items
removeRelationship (username, itemId, destItemId, relType, portalOpts)promiseDelete a relationship between items
addImageResourceFromUrl (itemId, owner, filename, url)promiseAdd an image at the specified url to the item as a resource

Groups Service

MethodReturnsDescription
search(form, portalOpts)promiseExecutes via /sharing/rest/community/groups. The form is an object properties matching the search params
getById(id, portalOpts)promiseReturns the Group.
getBulk(ids, portalOpts)promiseReturns an array of Groups.
getItemsById(id, portalOpts)promiseReturns Items in the group. Note: Does not currently support paging.
save(group, portalOpts)promiseCreates or Updates a group.
update(group, portalOpts)promiseUpdates an existing group.
create(group, portalOpts)promiseCreates an item. The .owner property must be set.
remove(id, portalOpts)promiseDelete the Group.
protect(id, portalOpts)promiseProtect the Group from deletion.
unprotect(id, portalOpts)promiseUnprotect the Group from deletion.
users(id, portalOpts)promiseReturn array of users that are members of the Group. Documentation
addUsers(id, users, portalOpts)promiseAdds users to the Group. Expects an array of usernames.
reassign(id, username, portalOpts)promiseReassign ownership of the group
remove(id, portalOpts)promiseDeletes a group from AGO
join(id, portalOpts)promiseRequest for current user to join a group
leave (id, portalOpts)promiseRequest for current user to leave a group
isUserGroupAdmin (id, username, portalOpts)booleanUser's group admin status
getUserMembership (id, username, portalOpts)promiseReturn the type of group membership of a user
updateUserMemberships (id, users, type, portalOpts)promiseUpdates membership(s) from user to admin or admin to user
ensureUniqueGroupName (title, step, portalOpts)promiseReturn a group name guaranteed to be unique in the org
doesGroupExist (title, portalOpts)promiseReturn a boolean indicating whether the group exists in the org

Sharing Service

The sharing service separates setting Access (private/shared/org/everyone) from sharing with a group. This allows the methods to be more deterministic.

MethodReturnsDescription
setAccess(owner, itemId, access, portalOpts)promisewhere access is null
shareWithGroup(owner, itemId, groupId, confirmItemControl, portalOpts)promiseShares an item with a group. confirmItemControl defaults to false. If set to true then itemControl (aka edit permission) is conferred via group membership
unShareWithGroup(owner, itemId, groupId, portalOpts)promiseUn-Share an item with a group.
changeGroupSharing(action, owner, itemId, groupId, portalOpts)promiseActual implementation of the sharing. Action can be 'share' or 'unshare'
isItemSharedWithGroup(itemId, groupId, portalOpts)promiseChecks to see if an item has already been shared with a group

User Service

MethodReturnsDescription
search(form, portalOpts) (deprecated)promiseDelegates to allUsers if user is authenticated or portalOpts is provided, otherwise delegates to searchUsers
searchCommunityUsers(form, portalOpts)promiseExecutes via /sharing/rest/community/users. The form is an object properties matching the search params
searchPortalUsers(form, portalOpts)promiseExecutes via /sharing/rest/portals/self/users. The form is an object properties matching the search params
getByName(username, portalOpts)promiseGet a user object by name.
update(user, portalOpts)promiseUpdate a user
signup (user, portalOpts)promiseSigns the user up to the organization

OAuth Service

Note: This is not used for authentication - rather its purpose is to allow Application Items to be programatically manipulated.

MethodReturnsDescription
registerApp (itemId, redirectUris, appType = 'browser', portalOpts)promiseRegisters an App item. Returning clientId, client secret etc
updateApp(clientId, redirectUris, portalOpts)promiseCurrently just supports changing the set of valid redirect uris. PR's accepted to expand this

Geocode Service

MethodReturnsDescription
findLocationAddress(inputString)promiseReturns a location address based on an input string that moves through a specified or default geocode url

Portal Service

MethodReturnsDescription
getById (id, portalOpts)promiseGet portal info by Id
self (portalOpts)promisePerform a portals/self call
update(portal, portalOpts)promiseUpdate a portal. Lots of rules apply to what can be changed
uploadResource (file)promiseUpload a file as a portal resource
addResource (name, content, portalOpts)promiseAdd a resource to a portal
getResources () promiseGet list of portal resources
removeResource (resourceName, portalOpts)promiseRemove a resource from a porta
users(portalId, start = 1, num = 100, portalOpts)promiseGet a portal users.
configureSocialProviders (opts, portalOpts)promiseConfigure social logins.
checkUsername (username, portalOpts)promiseChecks whether the specified username is available
checkUrlKey (urlKey, portalOpts)promiseChecks whether the specified urlKey is available
activate (opts, portalOpts)promiseActivates the organization

Folders Service

MethodReturnsDescription
getUserFolders (username, portalOpts)promiseResolves with an array of folders
folderExists (folderTitle, username, portalOpts)promiseResolves with bool
create (folderTitle, username, portalOpts)promiseCreates a folder
remove (folderId, username, portalOpts)promiseRemoves a folder

Hosted Service

Used to create/manage hosted feature services. Use the feature-service in ember-arcgis-server-services to work with features/records in the service.

MethodReturnsDescription
serviceExists (serviceName, orgId, portalOpts)promiseCheck if a service exists
create (svcParams, username, folderId, portalOpts)promiseCreate a Service + Item
addToDefinition (fsUrl, definition, layerId, portalOpts)promiseAdd/Edit a layer or table to the service
updateDefinition (fsUrl, definition, layerId, portalOpts)promiseUpdate a service/layer's definition

environment.js

Configuration for how to connect to the portal is managed in the torii section. If you are using ArcGIS Online, the portalUrl property is not needed.

// environment.js
...
torii: {
  sessionServiceName: 'session',
  providers: {
    'arcgis-oauth-bearer': {
      apiKey: 'SECRET-KEY-FOR-YOUR-APP',
      portalUrl: 'https://yourawesomeportal.com'
    }
  }
}
...

Running

Running Tests

Note: Currently there are no automated tests for this addon. PR's welcomed :)

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/" target="_blank" class="rg-linkified-code">http://ember-cli.com/.

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

License

Copyright 2017 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

Keywords

FAQs

Package last updated on 21 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc