add permission management

Change-Id: I4c9b851440fe1ecdfe4302dae36360236767d869
More things from my github

Change-Id: Ibd249b076309aff3421156deb9adbc5bb7938b6d