We have at the browser the user Profile Storage Permissions including the READ to the platform container.

This commit is contained in:
Luis Fernando Molina committed 2018-06-15 12:18:09 +02:00
1 parent 658b9434e7
commit c61f423f5f
3 files changed
+29 -8

No files matched your search

+13 -5
View File
@@ -24,7 +24,7 @@
let userProfile = {
userName: "Guest",
devTeams: [],
storagePermissions: new Map()
storagePermissions: []
};
/* The first possibility is that the sessionToken is not there. */
@@ -59,14 +59,22 @@
for (let i = 0; i < session.devTeams.length; i++) {
let devTeam = session.devTeams[i];
let readPermission = storageAccessManager.getPermission(devTeam, "READ", MAX_STORAGE_PERMISSION_DAYS);
let writePermission = storageAccessManager.getPermission(devTeam, "WRITE", MAX_STORAGE_PERMISSION_DAYS);
let container = devTeam.codeName.toLowerCase();
userProfile.storagePermissions.set(devTeam + "." + "READ", readPermission);
userProfile.storagePermissions.set(devTeam + "." + "WRITE", writePermission);
let readPermission = storageAccessManager.getPermission(container, "READ", MAX_STORAGE_PERMISSION_DAYS);
let writePermission = storageAccessManager.getPermission(container, "WRITE", MAX_STORAGE_PERMISSION_DAYS);
userProfile.storagePermissions.push([devTeam.codeName + "." + "READ", readPermission]);
userProfile.storagePermissions.push([devTeam.codeName + "." + "WRITE", writePermission]);
}
/* In order to be able to download a bot source code, the user will need READ permissions over the Platform container. */
let container = "aaplatform";
let readPermission = storageAccessManager.getPermission(container, "READ", MAX_STORAGE_PERMISSION_DAYS);
userProfile.storagePermissions.push(["AAPlatform" + "." + "READ", readPermission]);
callBackFunction(global.DEFAULT_OK_RESPONSE, userProfile);
}
+2 -3
View File
@@ -34,7 +34,7 @@
}
}
function getPermission(pTeam, pType, pDays) {
function getPermission(pContainer, pType, pDays) {
let azure = require('azure-storage');
let blobService = azure.createBlobService(permissions.connectionString);
@@ -58,7 +58,6 @@
}
}
let container = pTeam.codeName.toLowerCase();
let blobName = undefined;
let sharedAccessPolicy = {
@@ -69,7 +68,7 @@
}
};
let sasToken = blobService.generateSharedAccessSignature(container, blobName, sharedAccessPolicy);
let sasToken = blobService.generateSharedAccessSignature(pContainer, blobName, sharedAccessPolicy);
return "BlobEndpoint=https://aadevelop.blob.core.windows.net;SharedAccessSignature=" + sasToken + "";
+14
View File
@@ -26,6 +26,20 @@ function newEndUser() {
window.USER_LOGGED_IN = window.USER_PROFILE.userName;
/* Here we will rearrange the storage permissions array into a map, so that it can be easily consumed when needed. */
let permissionsMap = new Map;
for (i = 0; i < window.USER_PROFILE.storagePermissions.length; i++) {
let permission = window.USER_PROFILE.storagePermissions[i];
permissionsMap.set(permission[0], permission[1]);
}
window.USER_PROFILE.storagePermissions = permissionsMap;
}
function getContainer(point) {