...
The addition of the new field: termsOfServiceVersion
is a backwards compatible change. If an old client calls this service without providing this new field, a default value of ‘0.0.0’ will be used to indicate that the user has agreed to the deprecated ToS. If the user attempts to set a version that is newer than the current version, an error will be returned.
We will also update the LoginResponse object returned by: POST /login2 to include the more information the user’s ToS status. The UI can use this information to show a message to the user when they need to agree to new ToS.
New ToS APIs
The following will be the new ToS APIs. These new services will be added under the “Authentication Services”
Response | URL | Request | Description | Authorization |
---|---|---|---|---|
TermsOfServiceInfo | GET /termsOfUse2/info | none | Get information about the current ToS | Not Required |
TermsOfServiceInfo | POST PUT /termsOfUse2/requirements | TermsOfServiceRequirement | Sets the global ToS requirements. | Only ACT or Admin may make this call. |
TermsOfServiceStatus | GET /termsOfUse2/{userId}/status | none | Get the current user’s ToS status. Used to determine if the user needs to agree to the new ToSA user can only get their own status | This call needs to work with a standard auth token in the header to identify the user but the caller does know the ID of the user yet. |
Note: The starting TermsOfServiceRequirement will be set with minimumTermsOfServiceVersion=0.0.0
and requirementDate=1/1/2011
. All existing users that have agreed to the exiting ToS will meet the starting requirements. This means ACT will need to set the new requirements before users will be required.
...
Since this query can read millions of rows per project, we will cache (all containers for moves) the results for quick retrieval.
Note: While the following API will work for all combination, clients can “hard-code” the default Synapse storage location ID. The new API will be added under the “Project Setting Services”.
Response | URL | Request | Description | Authorization |
---|---|---|---|---|
ProjectStorageInfoProjectStorageUsage | GET /project/{projectId}/storage/infousage | none | Get the information about all combinations for a single project. | The UserEntityPermissions.hasUpload=true for the projectCombinationLimit. “Plan managers” will have access to this. |
ProjectStorageLocationLimit | POST /project/{projectId}/storage/limit | CombinationLimitProjectStorageLocationLimit | Set the limit for a single combination | Only members of the “plan managers” team may call this service. |
Checking Limits Before Upload
Before a client uploads a file to a project or folder, the client will first call GET /entity/{id}/uploadDestination. We will extend the resulting UploadDestionation object to include information about the containing project and its limits. This will allow clients to block the upload of a file that would be over the limit using the following pseudo-code:
Code Block |
---|
if (sumFileBytes + newFileSize > maxAllowedFileBytes) then block upload |
Since we are changing the UploadDestionation object, GET /entity/{id}/uploadDestination/{storageLocationId} service will also return the new project limit information.
Model Objects
TermsOfServiceInfo.json:
Code Block | ||
---|---|---|
| ||
{ "description": "Information about the current Synapse Terms of Service (ToS).", "properties": { "termsOfServiceUrl": { "type": "string", "description": "The URL that can be used to fetch the currentlatest ToS using an HTTPS GET." }, "termsOfServiceVersionlatestTermsOfServiceVersion": { "type": "string", "description": "The semantic version of the latest ToS in the provided URL. Callers will need to provide this version when submitting a request to agree to shown ToS." }, "currentRequirement": { "$ref": "org.sagebionetworks.repo.model.auth.TermsOfServiceRequirement", "description": "Information about the global ToS Synapse requirements that all users must agree to." } } } |
...
Code Block | ||
---|---|---|
| ||
{ "description": "The status of a user's ToS agreement", "properties": { "userId": { "type": "string", "description": "The ID of the user." }, "hasAgreedToRequiredTermsOfServiceusersCurrentTermsOfServiceState": { "type$ref": "boolean", "format": "date-timeorg.sagebionetworks.repo.model.auth.TermsOfServiceState", "description": "When false,Defines the user's has not agreed to the currently required version of the ToS. True, if the user has agreedcurrent ToS state. Used to guide the UI in what the user needs to do with their ToS agreements. This will always be provided." }, "lastAgreementDate": { "type": "string", "format": "date-time", "description": "The date/time when the user last agreed to the ToS. Will be null if the user has never agreed to the ToS." }, "lastAgreementVersion": { "type": "string", "description": "The version of ToS that the user last agreed to. Will be null if the user has never agreed to the ToS." } } } |
...
TermsOfServiceState.json:
Code Block | ||
---|---|---|
| ||
{
"type": "string",
"description": "The user's current ToS state defines what action if any they will need to take to meet ToS requirements.",
"enum": [
{
"name": "MUST_AGREE_NOW",
"description": "The user must agree to the new ToS before they can use the service."
},
{
"name": "MUST_AGREE_SOON",
"description": "The user currently has agreed to an older ToS and they will need to agree to the new ToS before new required date."
},
{
"name": "UP_TO_DATE",
"description": "The user has agreed to the latest ToS so they are up-to-date"
}
]
} |
ProjectStorageUsage.json
Code Block | ||
---|---|---|
| ||
{ "description": "Provides information about file allocations and limits for each storage location associated with a single project.", "properties": { "projectId": { "type": "string", "description": "The ID of the project" }, "combinationslocations": { "type": "array", "items": { "$ref": "org.sagebionetworks.repo.model.limits.ProjectStorageCombinationProjectStorageLocationUsage" } } } } |
ProjectStorageCombinationProjectStorageLocationUsage.json
Code Block | ||
---|---|---|
| ||
{ "description": "Represent the current size and limits for a single project storage location and project combination.", "properties": { "storageLocationId": { "type": "string", "description": "The ID of the storage location" }, "sumFileBytes": { "type": "integer", "description": "The total number of bytes, of files, currently associated with this project combinationstorage location." }, "maxAllowedFileBytes": { "type": "integer", "description": "When missing, there is not limit for this project combinationstorage location. When set, this number represent to the total number of allowed bytes for this combinationproject storage location. If the sumFileSizesBytes is greater than this value, then this project storage combinationlocation is over its limit all new uploads to this project storage combinationlocation will be blocked." }, "isOverLimit": { "type": "boolean", "description": "When true, sumFileSizesBytes is greater than maxAllowedFileSizeBytes and all new uploads to this project combinationstorage location will be blocked." } } } |
CombinationLimitProjectStorageLocationLimit.json
Code Block | ||
---|---|---|
| ||
{ "description": "Set the limit on the number of files bytes for storagea locationsingle andproject projectstorage combination.location", "properties": { "projectId": { "type": "string", "description": "The ID of the project" }, "storageLocationId": { "type": "string", "description": "The ID of the storage location" }, "maxAllowedFileBytes": { "type": "string", "description": "Sets the limit on the number of file bytes that can be associated with this project storage location." } } } |
UploadDestination.json
Code Block | ||
---|---|---|
| ||
{ "description": "The upload destination contains information to start an upload of a file generated according to the underlying <a href=\"${org.sagebionetworks.repo.model.project.StorageLocationSetting}\">StorageLocationSetting</a>.", "type": "interface", "properties": { "concreteType": { "type": "string", "description": "Indicates which implementation this combination object represents." }, "storageLocationId": { "type": "integer", "description": "the unique id for the storage location, that points to the <a href=\"${org.sagebionetworks.repo.model.project.StorageLocationSetting}\">StorageLocationSetting</a>" }, "uploadType": { "$ref": "org.sagebionetworks.repo.model.file.UploadType" }, "banner": { "type": "string", "description": "If set, the client should show this banner every time an upload is initiated" }, "destinationProjectId": { "type": "string", "description": "The ID of the project where this file will be uploaded." }, "projectStorageLocationUsage": { "$ref": "org.sagebionetworks.repo.model.limits.ProjectStorageLocationUsage", "description": "This object includes information about size and limits associated with this project storage location. Clients should not attempt to upload a file to this location if isOverLimit=true or if (<size_new_file> + sumFileBytes) is greater than maxAllowedFileBytes." } } } |