Role-Based Access Control(RBAC)

User -> Role -> Rights
– In enterprise setting, access may be based on job function or role of a user
payroll manager, project member etc.
access rights are associated with role
User authenticate themselves to the system
User then can activate one or more role for themselves

RBAC Benefits
Policy need not be updated when certain person with a role leaves the organization
New employee should be able to activate the desired role
Revisiting least privilege
user in one role has access to a subset of the files
switch roles to gain access to other resources

Genome

Blood Vessel, skin cell, Red Blood Cell

Trait: any distinguishing feature of an individual
1.Physical vs Behavioral
2.Visible vs Hidden
3.Innate vs Learned

situs inversus: a condition where the organs are arranged in a mirror image of the normal positioning.

Deoxynucleotides: the building blocks of DNA
Adenine, Thymin, Guanine, Cytosine

Density

Probability for continuous spaces

f(x)= 1/360, f(0) < x <= 360 Date * Time you were born P(x)= 0 f(x)= 0.0166 f(x<=noon) = 2*f(x>noon)
a=0.0555 1/18
b=0.0277 1/3*1/12

cowsay

Redhat and CentOS users: sudo yum install cowsay
[vagrant@localhost rss]$ cowsay all is not better
 ___________________
< all is not better >
 -------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

-manual
man cowsay

var home etc tmp

min jQuery is much faster than usual jQuery.

Instagram Authentication

Client ID, Client Secretを発行し、php、mysqlでInstagramのOauthの仕組みを使ったログインを実装していきます。

リフェレンス
http_build_query:Generates a URL-encoded query string from the associative (or indexed) array provided.
PDO::prepare — 文を実行する準備を行い、文オブジェクトを返す
$dbh = new PDO:PDOオブジェクトのメソッドでデータベースを操作、$dbhという変数でPDOオブジェクトを管理
fetch:フィールドの配列参照として次の行を取り出す
Instagram Authentication: https://www.instagram.com/developer/authentication/

<?php

require_once('config.php');

session_start();

if (empty($_GET&#91;'code'&#93;)){
   // 認証前の準備
   $params = array(
     'client_id' => CLIENT_ID,
     'redirect_uri' => SITE_URL.'redirect.php',
     'scope' => 'basic',
     'response_type' => 'code'
   );
   $url = 'https://api.instagram.com/oauth/authorize/?'.http_build_query($params);

   header('Location: '.$url);
   exit;
   // instagramへ飛ばす
} else {
  // 認証後の処理
  // usr情報の取得
  $params = array(
    'client_id' => CLIENT_ID,
    'client_secret' => CLIENT_SECRET,
    'code' => $_GET['code'],
    'redirect_uri' => SITE_URL.'redirect.php',
    'grant_type' => 'authorization_code'
  );
  $url = "https://api.instagram.com/oauth/access_token";

  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

  $res = curl_exec($curl);
  curl_close($curl);

  var_dump($res);
  exit;

  //user情報の格納
  // ログイン処理
  // index.phpに飛ばす
}