Skip to content

Commit

Permalink
Added a sample 'Application'
Browse files Browse the repository at this point in the history
  • Loading branch information
gdovicak committed Jan 17, 2014
1 parent 0e9d39f commit e18ab7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
27 changes: 23 additions & 4 deletions Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var User = (function(){
_this.id = 1,
_this.allowedOrgs = {};

function init(orgs){
_this.loadOrgs = function(orgs){
$(orgs).each(function(){
_this.allowedOrgs[this.orgName] = this;
});
Expand Down Expand Up @@ -58,11 +58,9 @@ var User = (function(){
return (_this.allowedOrgs['Root Org']) ? _this.allowedOrgs['Root Org'].role : 'Denied';
}

init(userOrgMap);
_this.loadOrgs(userOrgMap);
}



return User;
})();

Expand All @@ -85,3 +83,24 @@ var UserOrg = (function(){
};
return UserOrg;
})();

var Application = (function(){
function Application(dataCalls, user){
var _this = this;
_this.dataCalls = dataCalls,
_this.user = user,
_this.orgToValidate = new Organization('Org 1', 'Root Org');

_this.run = function(){
var orgProm = _this.dataCalls.getOrgRolesForUser(user.id);

orgProm.done(function(orgs){
_this.user.loadOrgs(orgs);
console.log(_this.user.getRoleFor(_this.orgToValidate));
});
}

}

return Application;
})();
7 changes: 0 additions & 7 deletions spec/OrgUserRoleSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,4 @@ describe("User should", function(){
expect(user.getRoleFor(child2)).toEqual('Denied');
});
});



});




0 comments on commit e18ab7c

Please sign in to comment.