aboutsummaryrefslogtreecommitdiff
path: root/app/models/agent.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add syntactic sugarhellekin2021-02-021-0/+6
| | | | | | | | | | | | To some it may be more straightforward to think of the members of an Agent as "users". This commit accepts using `Agent#users` instead of `Agent#members`, but warns developers that they should be using the other method. Since Agent has_many Users, the Principle of Least Surprise warrants that `agent.users` does something. But they're really members.
* REUSE: Add AGPL-3.0-or-later to app/*hellekin2020-10-291-0/+4
|
* Add Classifications and Resource validationshellekin2020-10-091-0/+11
| | | | | | | | | | | | | | | | - Turn `has_and_belongs_to_many` into `has_many :through`: now, resources and sections are related through Classifications. - Refactor usage of jsonb column to use ActiveRecord validations - Attention! store_accessor: NOTE: If you are using structured database data types (eg. PostgreSQL hstore/json, or MySQL 5.7+ json) there is no need for the serialization provided by .store. Simply use .store_accessor instead to generate the accessor methods. Be aware that these columns use a string keyed hash and do not allow access using a symbol. NOTE: The default validations with the exception of uniqueness will work. For example, if you want to check for uniqueness with hstore you will need to use a custom validation to handle it. https://api.rubyonrails.org/classes/ActiveRecord/Store.html
* Add Resource modelhellekin2020-10-061-0/+1
| | | | | | Resources will be stored as JSON, in the (GeoJSON) :feature column. They are assigned an UUID upon creation if they don't comme with one. They belong to an Agent.
* Add Agent and Agency modelshellekin2020-10-051-0/+4
Since IN COMMON is about collective management of data we're using the concept of Agent to describe a group of users acting together. In ActivityPub terms, Agent will be the Actor when manipulating data, so that any individual User (or application) member of this Agent will be able to manipulate data on behalf of this Agent. Therefore a User has many Agencies, and an Agent as well: the Agency model allows not only to create a joint table between Agents and Users, but also to manage User roles within the related Agent. Roles are defined as: - observer: one who can read and review or flag data - editor: one who create or edit data - maintainer: one who can edit data and manage maps - leader: one who can manage roles A User may have zero or more roles in an Agent. A User without a Agency record for a specific Agent will only be able to 'observe' public data from this Agent. (Note that this is not currently specified, but matches existing reflection on Agents) https://doc.incommon.cc/#agents