`
CaiDeHen
  • 浏览: 96882 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

#20 Restricting Access

阅读更多
In this second part of the series on administration, you will learn how to lock down the site to keep the public from accessing the administration features.
<!-- episodes/index.rhtml -->
<% if admin? %>
  <%= link_to 'New Episode', new_episode_path %>
<% end %>
# controllers/application.rb
helper_method :admin?

protected

def admin?
  false
end

def authorize
  unless admin?
    flash[:error] = "unauthorized access"
    redirect_to home_path
    false
  end
end

# episodes_controller.rb
before_filter :authorize, :except => :index
分享到:
评论

相关推荐

    Linux_Security_Cookbook

    The Linux Security Cookbook includes real solutions to a wide range of targeted problems, such as sending encrypted email within Emacs, restricting access to network services at particular times of ...

    Oracle Database 10g: The Top 20 Features for DBAs

    **Description:** VPD enhances security by dynamically restricting access to data based on user attributes or session characteristics. It ensures that users only see data they are authorized to access....

    Exam E20-040 EMC by Actualtest

    ControlCenter Functionality Restricting Host Access ControlCenter提供了限制主机访问特定资源的功能。这有助于实现精细化的访问控制策略,确保只有授权的主机才能访问指定的存储资源,增强了系统的安全性和合规...

    System Security Lecture Notes (StonyBrook CSE509)

    This involves ensuring that users can access the system resources they need while preventing unauthorized access or actions that could compromise the system's integrity or availability. #### ...

    考研英语备战:长难句例句分析(15).doc

    在第二个例句“The Internet-and pressure from funding agencies, who are questioning why commercial publishes are making money from government-funded research by restricting access to it - is making ...

    strongloop离线官方文档

    - **1.9.4 Restricting access to related models**:解释了如何限制对关联模型的访问。 - **1.9.5 Creating a default admin user**:提供了创建默认管理员用户的步骤。 - **1.9.6 Security considerations**:...

    Windows注册表的攻击与防护.doc

    The registry can be protected by using security software, restricting access to the registry, and regularly backing up the registry. 在注册表旳保护中,INF 文献、JS 文献和组方略功能是常用的方法。INF ...

    Vulkan CookBook

    This is one of the main reasons for restricting the hardware to show its full potential. The new approach tries to overcome these struggles–it gives users much more control over the hardware, but ...

    Cisco Press - OSPF Network Design Solutions, 2nd Edition

    Contents at a Glance Introduction xix Part I OSPF Fundamentals and Communication 3 Chapter 1 Networking and Routing Fundamentals 5 Chapter 2 Introduction to OSPF 47 Chapter 3 OSPF Communication 103 ...

    BSD Hacks.pdf

    22. **Restricting Logins (HACK 34):** Strategies for controlling and limiting logins, such as setting up IP address restrictions or user account limitations, to enhance security. #### Backing Up ...

    Clean Architecture A Craftsman's Guide to Software Structure and Design

    See how programming paradigms impose discipline by restricting what developers can do Understand what’s critically important and what’s merely a “detail” Implement optimal, high-level structures...

    Django 1.0 Website Development.pdf

    Restricting access to logged-in users 80 Methods for browsing bookmarks 81 Improving the user page 83 Creating a tag page 85 Building a tag cloud 87 A word on security 90 SQL injection 91 Cross...

    Clean Architecture

    Master essential software design principles for addressing function, component separation, and data management, See how programming paradigms impose discipline by restricting what developers can do, ...

    2021年CKS 最新大纲.docx

    Chapter 3: Restricting ServiceAccount Permissions -- RBAC 在这个章节中,我们将学习如何限制 ServiceAccount 的权限,使用 RBAC(Role-Based Access Control)来控制 Pod 的访问权限。RBAC 是 Kubernetes 中的...

    2019考研英语历年真题神怪短语和表达[收集].pdf

    7. **Restricting Access To It** - 缩紧...的入口,限制进入或获取的机会。 8. **Far-Reaching Consequences** - 深远的意义或后果,指影响广泛。 9. **Scientific Endeavor** - 科学事业上的努力,指科学研究或...

    Manning.Spring.in.Action.4th.Edition.2014.11.epub

    14.1.1. Restricting method access with @Secured 14.1.2. Using JSR-250’s @RolesAllowed with Spring Security 14.2. Using expressions for method-level security 14.2.1. Expressing method access rules ...

    linux内核设计与实现第二章文.pdf

    This separation ensures security and stability by restricting access to critical system resources. 2.4 内核假设与差异 Linux内核对底层硬件和软件环境做出多个假设。例如,它假定有一定的硬件兼容性,如...

Global site tag (gtag.js) - Google Analytics