SECURITY: Moderators should not see API keys

This commit is contained in:
Robin Ward 2015-10-14 15:40:23 -04:00
parent a527c58c7d
commit e8424bd54e
2 changed files with 20 additions and 18 deletions

View File

@ -203,23 +203,25 @@
</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.api.key'}}</div>
{{#if model.api_key}}
<div class='long-value'>
{{model.api_key.key}}
{{d-button action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button action="revokeApiKey" icon="times" label="admin.api.revoke"}}
</div>
{{else}}
<div class='value'>
&mdash;
</div>
<div class='controls'>
{{d-button action="generateApiKey" icon="key" label="admin.api.generate"}}
</div>
{{/if}}
</div>
{{#if currentUser.admin}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.api.key'}}</div>
{{#if model.api_key}}
<div class='long-value'>
{{model.api_key.key}}
{{d-button action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button action="revokeApiKey" icon="times" label="admin.api.revoke"}}
</div>
{{else}}
<div class='value'>
&mdash;
</div>
<div class='controls'>
{{d-button action="generateApiKey" icon="key" label="admin.api.generate"}}
</div>
{{/if}}
</div>
{{/if}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.admin'}}</div>

View File

@ -65,7 +65,7 @@ class AdminDetailedUserSerializer < AdminUserSerializer
end
def include_api_key?
api_key.present?
scope.is_admin? && api_key.present?
end
def suspended_by