Skip to content

Instantly share code, notes, and snippets.

View rishav's full-sized avatar

Rishav Rastogi rishav

View GitHub Profile
if(Yii::app()->user->isSuperuser)
echo "I am one of the superuser of application, I have all access to app.";
var_dump(Yii::app()->getModule("rights")->getAuthorizer()->getSuperusers());
$roles=Rights::getAssignedRoles(Yii::app()->user->Id);
foreach($roles as $role)
echo $role->name."<br />";
$data_entry_users=Yii::app()->getAuthManager()->getAssignmentsByItemName('DataEntry');
$data_entry_users_id=array();
foreach($data_entry_users as $id=>$assignment)
$data_entry_users_id[]=$id;
if(Yii::app()-&gt;user-&gt;isSuperuser)
$type=$_POST['Type'];</div>
else
 $type='User';
$authorizer = Yii::app()-&gt;getModule("rights")-&gt;getAuthorizer();
$authorizer-&gt;authManager-&gt;assign($type, $model-&gt;id);
@rishav
rishav / gist:4284455
Created December 14, 2012 10:39
Example of SSH config, setting up hostname shortcuts
Host production
Hostname production.example.com
User ubuntu
IdentityFile ~/secretlocation/example.pem
Host staging
Hostname staging.example
User deploy
@rishav
rishav / gist:5803756
Created June 18, 2013 08:54
Simple Bash Profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
source ~/.bashrc
source ~/.scripts/.git-completion.bash
#for adding branch to the terminal
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "