ckanext-cadastaroles documentation¶
Extended Permissions¶
The standard CKAN permissions have been expanded
- read (dataset)
- delete_dataset
- create_dataset
- update_dataset
- manage_group
- read_cadasta_resource
- create_cadasta_resource
- update_cadasta_resource
- delete_cadasta_resource
- read_survey
- create_survey
- update_survey
- delete_survey
- read_parcel
- create_parcel
- update_parcel
- delete_parcel
- read_relationship
- create_relationship
- update_relationship
- delete_relationship
These permissions are checked by the ckan authorization functions, see Action functions and authorization functions in the ckan documentation http://docs.ckan.org/en/latest/extensions/tutorial.html#implementing-the-iauthfunctions-plugin-interface
Extended Roles¶
The standard CKAN roles have been extended to make use of the extended permissions. The roles below all correspond to users inside and organization
Permission | Surveryor | Community User | Community Admin | Admin |
---|---|---|---|---|
read (dataset) | yes | yes | yes | yes |
delete_dataset | no | no | yes | yes |
create_dataset | no | yes | no | yes |
update_dataset | no | yes | yes | yes |
manage_group | no | no | yes | yes |
read_cadasta_resource | no | yes | yes | yes |
create_cadasta_resource | no | yes | yes | yes |
update_cadasta_resource | no | yes | yes | yes |
delete_cadasta_resource | no | yes | yes | yes |
read_survey | yes | yes | yes | yes |
create_survey | yes | no | yes | yes |
update_survey | yes | no | yes | yes |
delete_survey | yes | no | yes | yes |
read_parcel | yes | yes | yes | yes |
create_parcel | yes | no | yes | yes |
update_parcel | yes | no | yes | yes |
delete_parcel | yes | no | yes | yes |
read_relationship | yes | yes | yes | yes |
create_relationship | yes | no | yes | yes |
update_relationship | yes | no | yes | yes |
delete_relationship | yes | no | yes | yes |
Cadasta Admins¶
An additional user type, the Cadasta admin has administrative permission over all organizations, these users can only be assigned by system administrators. These can be assigned in the CKAN administration tab.
Action API Reference¶
The action functions added by ckanext-cadastaroles are an extension of the CKAN API, for details on api example api usage, see http://docs.ckan.org/en/latest/api/index.html
-
ckanext.cadastaroles.logic.action.cadastaadmin.
cadasta_admin_create
(context, data_dict)¶ Make a user a Cadasta admin
Cadasta admin can administer all organizations. You must be a sysadmin to make this api call.
Parameters: username (str) – the username of the cadasta admin to delete Return type: bool (success)
-
ckanext.cadastaroles.logic.action.cadastaadmin.
cadasta_admin_delete
(context, data_dict)¶ Delete a cadasta admin
You must be a sysadmin to make this api call
Parameters: username (str) – the username of the cadasta admin to delete Return type: bool (success)
-
ckanext.cadastaroles.logic.action.cadastaadmin.
cadasta_admin_list
(context, data_dict)¶ Show the list of admins that can administer all organizations
You must be a sysadmin to make this api call
Return type: list of user ids
-
ckanext.cadastaroles.logic.action.cadastaorganization.
cadasta_get_organization
(context, data_dict)¶ Make api call to cadasta api show relationship
Fetch one, or all cadast api organizations, you must be a sysadmin to perform this request
Parameters: - id (int) – optional, if not provided, fetch all organizations.
- sort_by (str) – optional (ASC or DESC)
- sort_dir (str) – optional (ASC or DESC)
- limit (int) – number of records to return (optional)
- returnGeometry (boolean) – whether to return geometry (optional, default: false)
Return type: dict
-
ckanext.cadastaroles.logic.action.parcel.
cadasta_show_parcel
(context, data_dict)¶ Make api call to cadasta api show get
if parcel id is not provided, then if you are a sysadmin all parcels are returned
Parameters: - id (str) – the id of the parcel (optional)
- fields (str) – Options: id, spatial_source, user_id, time_created, time_updated
- sort_by (str) – Options: id, spatial_source, user_id, time_created,
- sort_dir (str) – optional (ASC or DESC)
- limit (int) – number of records to return
- returnGeometry (boolean) – whether to return geometry (optional, default: false)
- project_id (int) – project id the parcel belongs to (optional)
Return type: dict
-
ckanext.cadastaroles.logic.action.parcel.
cadasta_show_parcel_detail
(context, data_dict)¶ Make api call to cadasta api parcel show detail
Parameters: id (str) – the id of the parcel Return type: dict
-
ckanext.cadastaroles.logic.action.parcel.
cadasta_show_parcel_relationship_history
(context, data_dict)¶ Make api call to cadasta api parcel show relationship history
Parameters: - id (str) – the id of the parcel
- fields (str) – Options: id, spatial_source, user_id, time_created, time_updated
- sort_by (str) – Options: id, spatial_source, user_id, time_created,
- sort_dir (str) – optional (ASC or DESC)
- limit (int) – number of records to return
Return type: dict
-
ckanext.cadastaroles.logic.action.parcel.
cadasta_show_parcel_resource
(context, data_dict)¶ Make api call to cadasta api parcel show relationship history
Parameters: - id (str) – the id of the parcel
- fields (str) – Options: id, spatial_source, user_id, time_created, time_updated
- sort_by (str) – Options: id, spatial_source, user_id, time_created,
- sort_dir (str) – optional (ASC or DESC)
- limit (int) – number of records to return
Return type: dict
-
ckanext.cadastaroles.logic.action.relationships.
cadasta_show_relationship
(context, data_dict)¶ Make api call to cadasta api show relationships
Parameters: - fields (str) – Options: id, spatial_source, user_id, time_created, time_updated
- sort_dir – optional (ASC or DESC)
- limit (int) – number of records to return
- returnGeometry (boolean) – whether to return geometry (optional, default: false)
Return type: dict