aboutsummaryrefslogblamecommitdiffstats
path: root/Zotlabs/Access/PermissionLimits.php
blob: 909b654d5f17173491903472b6a234200c662823 (plain) (tree)
1
2
3
4
5
6
7



                         

                         
                        












                                                             
                                                                   
                                                                               



                                                            
                                                                                  

                      



                                                                                                                                     

                 
 
<?php

namespace Zotlabs\Access;

use \Zotlabs\Lib as ZLib;

class PermissionLimits {

	static public function Std_Limits() {
		$perms = Permissions::Perms();
		$limits = array();
		foreach($perms as $k => $v) {
			if(strstr($k,'view'))
				$limits[$k] = PERMS_PUBLIC;
			else
				$limits[$k] = PERMS_SPECIFIC;
		}
		return $limits;
	}

	static public function Set($channel_id,$perm,$perm_limit) {
		ZLib\PConfig::Set($channel_id,'perm_limits',$perm,$perm_limit);
	}

	static public function Get($channel_id,$perm = '') {
		if($perm) {
			return Zlib\PConfig::Get($channel_id,'perm_limits',$perm);
		}
		else {
			Zlib\PConfig::Load($channel_id);
			if(array_key_exists($channel_id,\App::$config) && array_key_exists('perm_limits',\App::$config[$channel_id]))
				return \App::$config[$channel_id]['perm_limits'];
			return false;
		}
	}	
}