forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #13. Error thrown for unncessary reason.
- Modify serverside method to not check if user is logged in. Method does not return sensitive information, and does not depend on the current user. - Add permissionIds isn't undefined/null check to serverside method. - Move security banner logic, display to its own template. Helps to separate RocketChat and chat-locker code. Makes banner modular and reuseable. - banner is reactively dependent on Session's roomData+roomId. access permission changes will propagate to new security banner template.
- Loading branch information
Showing
5 changed files
with
34 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Template.securityBanner.helpers | ||
bannerData: -> | ||
Template.instance().updateBannerData(this.permissions) | ||
return Template.instance().bannerData.get() | ||
|
||
|
||
Template.securityBanner.onCreated -> | ||
self = this | ||
this.bannerData = new ReactiveVar {text:'Unknown', classificationId : 'U'} | ||
|
||
this.updateBannerData = (accessPermissions) -> | ||
# ignore undefined/null | ||
unless accessPermissions | ||
return | ||
|
||
Meteor.call 'getSecurityBanner', accessPermissions, (error, result) -> | ||
if error | ||
console.error error.reason | ||
else | ||
self.bannerData.set result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template name="securityBanner"> | ||
{{#with bannerData}} | ||
<div class="security-banner {{classificationId}}"> | ||
{{text}} | ||
</div> | ||
{{/with}} | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters